We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi guys. How I can get post category name? I tried to find a way but I failed.
The text was updated successfully, but these errors were encountered:
Hi there!
Well you can return a collection with all categories with the Taxonomy model.
Taxonomy
Taxonomy::where('taxonomy', 'category')->get()
The collection contains all categories as models. You can call name in order to get the name of the category.
name
Taxonomy::where('taxonomy', 'category')->get()->first()->name
If you have a post and you need the category name then you will need to call category_name.
category_name
Post::published()->type('post')->slug($slug)->with('attachment')->firstOrFail()->category_name
Sorry, something went wrong.
No branches or pull requests
Hi guys. How I can get post category name? I tried to find a way but I failed.
The text was updated successfully, but these errors were encountered: