check(); } /** * Prepare the data for validation. * * @return void */ protected function prepareForValidation() { $this->merge([ 'status' => $this->status ? true : false, 'authorizedFolders' => $this->authorizedFolders ? $this->authorizedFolders : [], ]); } /** * Get the validation rules that apply to the request. * * @return array */ public function rules() { return [ 'lastname' => 'required|min:3|max:255', 'firstname' => 'required|min:3|max:255', 'email' => 'required|min:3|max:255|email:rfc,dns|unique:app_users,email', 'password' => [ 'required', 'required_with:password_confirmation', 'confirmed', 'max:255', Password::min(8) ->letters() ->mixedCase() ->numbers() ->symbols() ], 'authorizedFolders' => 'present|array', 'role' => [ 'required', new EnumIsValidRule(AppUserRolesEnum::class) ], 'status' => 'required|boolean' ]; } /** * Get custom attributes for validator errors. * * @return array */ public function attributes() { return [ 'lastname' => \trans('nom'), 'firstname' => \trans('prénom'), 'email' => \trans('email'), 'password' => \trans('mot de passe'), 'authorizedFolders' => \trans('dossiers autorisés'), 'role' => \trans('rôle'), 'status' => \trans('statut') ]; } }