2

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 1

1
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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.