check(); } /** * Prepare the data for validation. * * @return void */ protected function prepareForValidation() { $this->merge([ 'published' => $this->published ? true : false ]); $this->mergePicture('picture'); } /** * Get the validation rules that apply to the request. * * @return array */ public function rules(): array { $rules = [ 'picture_alt' => 'required|string|between:3,255', 'picture_title' => 'required|string|between:3,255', 'published' => 'required|boolean', ]; return \array_merge( $rules, $this->pictureRules('picture', 120, 120, 120, 120, false), ); } /** * Get custom attributes for validator errors. * * @return array */ public function attributes(): array { return [ 'picture_alt' => trans('validation.custom.picture_alt'), 'picture_title' => trans('validation.custom.picture_title'), 'published' => trans('validation.custom.activated'), ]; } }