check(); } /** * Prepare the data for validation. * * @return void */ protected function prepareForValidation() { $this->merge([ 'status' => $this->status ? true : false ]); } /** * Get the validation rules that apply to the request. * * @return array */ public function rules() { return [ 'directory_id' => 'sometimes|nullable|integer', 'document_id' => 'sometimes|nullable|integer', 'uuid' => 'required|min:3|max:255', 'title' => 'required|min:3|max:255', 'type' => 'required|min:3|max:255', 'path' => 'required|min:3|max:255', 'lang' => [ 'required', new EnumIsValidRule(LangEnum::class) ], 'status' => 'required|boolean' ]; } /** * Get custom attributes for validator errors. * * @return array */ public function attributes() { return [ 'directory_id' => \trans('dossier à associer'), 'document_id' => \trans('document (FR) à associer'), 'title' => \trans('titre'), 'uuid' => \trans('document'), 'type' => \trans('type du document'), 'path' => \trans('chemin du document'), 'lang' => \trans('langue du document'), 'status' => \trans('état de publication du document'), ]; } }