Skip to content

Commit

Permalink
Implement suspend action feature
Browse files Browse the repository at this point in the history
  • Loading branch information
cholladay0816 committed Dec 27, 2023
1 parent 8ac10dd commit 7fb8bb1
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions app/Nova/Actions/Suspend.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
use Laravel\Nova\Actions\Action;
use Laravel\Nova\Actions\DestructiveAction;
use Laravel\Nova\Fields\ActionFields;
use Laravel\Nova\Fields\Number;
use Laravel\Nova\Fields\Text;
use Laravel\Nova\Http\Requests\NovaRequest;

class Suspend extends DestructiveAction
Expand All @@ -25,7 +27,10 @@ class Suspend extends DestructiveAction
*/
public function handle(ActionFields $fields, Collection $models)
{
//
foreach($models as $model)
{
$model->suspend($fields->get('days'), $fields->get('reason'));
}
}

/**
Expand All @@ -35,6 +40,9 @@ public function handle(ActionFields $fields, Collection $models)
*/
public function fields(NovaRequest $request)
{
return [];
return [
Number::make('Days'),
Text::make('Reason')
];
}
}

0 comments on commit 7fb8bb1

Please sign in to comment.