route('settings')); } /** * Prepare the data for validation. * * @return void */ protected function prepareForValidation(): void { $this->mergePicture('logo'); } /** * Get the validation rules that apply to the request. * * @return array */ public function rules(): array { $numberOfLocales = count(config('app.locales')); $rules = [ 'locales' => "required|array|between:1,$numberOfLocales", 'sub_title' => "required|array|between:0,$numberOfLocales", 'sub_title.*' => 'nullable|min:2|max:110', 'footer_phrase' => "required|array|between:1,$numberOfLocales", 'footer_phrase.*' => 'required|min:2|max:110', 'color' => ['required', new Hex()], 'home_timeout' => 'required|numeric|min:20|max:900', ]; return \array_merge( $rules, $this->pictureRules('logo', 420, 500, 420, 500, false) ); } /** * Get custom attributes for validator errors. * * @return array */ public function attributes(): array { return [ 'locales' => \trans('validation.custom.locales'), 'color' => \trans('validation.custom.color'), 'logo' => \trans('validation.custom.logo'), 'home_timeout' => \trans('validation.custom.home_timeout'), 'sub_title.*' => \trans('validation.custom.sub_title'), 'footer_phrase.*' => \trans('validation.custom.footer_phrase'), ]; } }