user(); return ($user and $user->can('update', $this->payment_mode)) && parent::authorize(); } /** * Prepare the data for validation. * * @return void */ public function prepareForValidation(): void { $this->merge([ 'status' => $this->status ? true : false ]); parent::prepareForValidation(); } /** * Get the validation rules that apply to the request. * * @return array */ public function rules(): array { return array_merge([ 'status' => 'required|boolean' ], parent::rules()); } /** * Get custom attributes for validator errors. * * @return array */ public function attributes(): array { return [ 'data.payment_mode_label.value' => \trans('texte du mode'), 'data.payment_mode_logo.value' => \trans('logo du mode'), 'data.payment_mode_logo_display.value' => \trans('afficher l\'îcone'), ]; } }