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:
1composer require kirschbaum-development/nova-inline-select
Next, use the InlineSelect
in your resource:
1namespace App\Nova; 2 3use KirschbaumDevelopment\Nova\InlineSelect; 4 5class User extends Resource 6{ 7 // ... 8 9 public function fields(Request $request)10 {11 return [12 // ...13 14 InlineSelect::make('Status'),15 16 // ...17 ];18 }19}
Finally, to enable the inline editing capabilities you can use the inlineOnIndex()
and inlineOnDetail()
methods.
1InlineSelect::make('Status')->options($options)2 ->inlineOnIndex()3 ->inlineOnDetail(),
For more details on this Laravel Nova package check out the Github project.
0 comments:
Post a Comment
Thanks