cviebrock / eloquent-taggable

Easily add the ability to tag your Eloquent models in Laravel.
MIT License
559 stars 72 forks source link

Retuurn collection with tags #62

Closed jasminetracey closed 7 years ago

jasminetracey commented 7 years ago

How do i get all tags when returning a collection?

Article::with('tags')->published() ->latest() ->paginate(7); This does not work

cviebrock commented 7 years ago

You figured it out? The above should work, depending on how your published and latest query scopes are written.

But, you could always do:

$articles = Article::published()->latest()->paginate(7);
$articles->load('tags');
...
jasminetracey commented 7 years ago

yes i did