mr-vaco / nova-blog
Blog manager for Laravel Nova
Requires
- php: ^7.3|^8.0
- mr-vaco/nova-gallery: ^1.0
- mr-vaco/nova-panels: ^1.0.7
- mr-vaco/nova-statuses-manager: ^1.0
- mr-vaco/nova-trumbowyg-field: ^1.0
README
Installation
composer require mr-vaco/nova-blog
php artisan vendor:publish --tag=blog-migrations
If the "NovaGallery" component has not been installed previously: NovaGallery
If the "NovaStatusesManager" component has not been installed previously: NovaStatusesManager
php artisan migrate
php artisan db:seed --class=\\MrVaco\\NovaBlog\\Database\\Seeders\\BlogCategorySeeder
Ready! Go to the admin panel and be satisfied with the result! :)
API
All requests return ONLY active records
Categories
List of categories: /api/blog/categories
{ "data": [], "links": {}, "meta": {} }
Get a category by slug: /api/blog/categories/{slug}
{
"data": {}
}
Posts
Get post by slug from a category: /api/blog/categories/{category:slug}/{post:slug}
{
"data": {}
}
Get posts from a category: /api/blog/categories/{category:slug}/posts
{ "data": [], "links": {}, "meta": {} }
Get "recommended" posts from a category: /api/blog/categories/{category:slug}/recommended
{ "data": [], "links": {}, "meta": {} }
Post sorting
For routes /api/blog/categories/{category slug}/posts
and /api/blog/categories/{category slug}/recommended
you can specify the column by which records will be sorted, as well as the sorting direction.
Sort by column:
order
Sorting direction:
direction
For example, sorting by column "updated_at" with direction "asc":
/api/blog/categories/{category slug}/posts?order=updated_at&direction=asc
/api/blog/categories/{category slug}/recommended?order=updated_at&direction=asc
By default, sorting is performed by the column "published_at" with the direction "desc"