withoutConfirmation(); } /** * Perform the action on the given models. * * @param \Laravel\Nova\Fields\ActionFields $fields * @param \Illuminate\Support\Collection $models * @return mixed */ public function handle(ActionFields $fields, Collection $models) { if($models->first()->participated == 1){ Action::danger('Vous avez déjà participé'); } else{ $contest = Contest::find($models->first()->id); $contest->participated = 1; $contest->save(); Action::message('Participation en cours'); } } /** * Get the fields available on the action. * * @param \Laravel\Nova\Http\Requests\NovaRequest $request * @return array */ public function fields(NovaRequest $request) { return []; } }