This tutorial will teach you how to add custom action unpublish to Posts BREAD
If you’re new to Laravel Voyager, check out the Getting Started docs and follow this complete tutorial by Cornor Leech on Build a fullstack admin app with Voyager in 5 minutes
This tutorial will continue from above tutorial which the installed voyager with dummy data. Expected result after complete install the laravel voyager and able to login into laravel voyager admin panel.
Start your application by run this
php artisan serve command at project folder and then browse this http://127.0.0.1:8000/admin address and login with default credentials
email@example.com / password.
Above is the dashboard after login and browse to Posts module from side menu or browse to this address http://127.0.0.1:8000/admin/posts.
We will add another action with name publish by create a Action Class with extend Voyagers AbstractAction in app/Actions/PublishAction.php
To enable above action, we need add new line of code in
app/Providers/AppServiceProvider.php under the
Next we need to add publish route for the post at
The route is point to new
app/Http/Voyager/PostController.php with extend VoyagerBaseController.
Now you can publish and un-publish your from Posts BREAD from custom action.
Thanks for reading! Here the full working code in Github.