Laravel Nova Inline Select
Published on by Eric L. Barnes
Laravel Nova Inline Select is a package that allows you to change the status of a resource directly from the index or detail views.
"We have some internal resources that we manage with a small Laravel Nova project. Managing the resources was quite easy and has saved us a lot of manual work. There was however one small tool we kept wanting to reach for, but unfortunately it didn’t exist.", Brandon Ferens said in the announcement of the package. "To update the status of a resource we would have to go to the update view, change the status, then save it. This became more cumbersome when more that one resource needed the status updated."
Nova Inline Select solves these problems by adding a form to the list of resources and it can even auto submit when change a the value. Here is a screenshot of it in action:
How to use the Nova Inline Select
First, install the package:
composer require kirschbaum-development/nova-inline-select
Next, use the InlineSelect
in your resource:
namespace App\Nova; use KirschbaumDevelopment\Nova\InlineSelect; class User extends Resource{ // ... public function fields(Request $request) { return [ // ... InlineSelect::make('Status'), // ... ]; }}
Finally, to enable the inline editing capabilities you can use the inlineOnIndex()
and inlineOnDetail()
methods.
InlineSelect::make('Status')->options($options) ->inlineOnIndex() ->inlineOnDetail(),
For more details on this Laravel Nova package check out the Github project.
Eric is the creator of Laravel News and has been covering Laravel since 2012.