key === "Button1" || $this->key === "Button2" || $this->key === "Button3" || $this->key === "ShowIsActive" ) { return auth('backend')->check(); } else { return (auth('backend')->check() && Auth::user()->role === 1); } } /** * Prepare the data for validation. * * @return void */ protected function prepareForValidation() { if ($this->key === "ShowIsActive") { $this->merge(['value' => $this->value ? "true" : "false"]); } if ( $this->key === "SquaredLogo" || $this->key === "RectangleLogo" || $this->key === "BackgroundImage" || $this->key === "HomeButtonImage" ) { $this->mergePicture('value'); } } /** * Get the validation rules that apply to the request. * * @return array */ public function rules() { $rules = [ 'value' => 'required|string|min:1', ]; if ( $this->key === "SquaredLogo" || $this->key === "RectangleLogo" || $this->key === "BackgroundImage" || $this->key === "HomeButtonImage" ) { return \array_merge( $rules, $this->pictureRules('value', true, 100, 100, 1920, 1200), ); } else { return $rules; } } /** * Get custom attributes for validator errors. * * @return array */ public function attributes() { return [ 'key' => \trans('clé'), 'value' => \trans('valeur'), ]; } }