check(); } /** * Get the validation rules that apply to the request. * * @return array|string> */ public function rules(): array { return [ 'type' => [ Rule::requiredIf($this->user()->can('create', $this->sticky)), new Enum(StaticPageType::class) ], 'title' => 'required|string|between:3,255', 'anchor' => [ Rule::requiredIf($this->user()->can('create', $this->sticky)), 'string', 'between:3,255' ], 'color' => [ Rule::requiredIf($this->user()->can('create', $this->sticky)), new Enum(StickiesColorEnum::class) ], ]; } /** * Get custom attributes for validator errors. * * @return array */ public function attributes(): array { return [ 'type' => trans('validation.custom.type'), 'title' => trans('validation.attributes.title'), 'anchor' => trans('validation.custom.anchor'), 'color' => trans('validation.custom.color'), ]; } }