I am using Nova laravel dashboard. I want to achieve is to add drop-down with option and by that I can change status in database. I added action for changing status, now I want a way to add drop-down in action box so admin can select the option and when confirm the can will be made to database. Is there a way to do so? Or is there any other way to achieve the desired output. Help would be really appreciated!!!
1 Answer
class Status extends Action
{
use InteractsWithQueue, Queueable;
public function handle(ActionFields $fields, Collection $models)
{
foreach($models as $model) {
$model->update([
'status' => $fields->status
]);
}
return Action::message('Status has been successfully updated!');
}
public function fields()
{
return [
Select::make('Status')->options([
'approved' => 'Approve',
'declined' => 'Decline',
])->default(function ($request) {
return 'approved';
})
];
}
}
you can pass your selected drop-down option status code on click button and perform action as above