AliBayat / Laravel-Categorizable

Implementing Categories system for Laravel's Eloquent models.
MIT License
60 stars 10 forks source link

get all Categories form a model #1

Closed hosseinjarrahi closed 4 years ago

hosseinjarrahi commented 4 years ago

how we can get all categories from a model , like below : $cats = Post::categories()

AliBayat commented 4 years ago

at the moment.. categories are same for all models.. with that in mind, you can easily use: Category::all();

and for categories attached to a single entity, for example a post: $post->categoriesList();

AliBayat commented 4 years ago

refer to documentation