user() !== null; } protected function prepareForValidation(): void { $this->merge([ 'name' => Str::of((string) $this->input('name'))->trim()->value(), ]); } /** * Get the validation rules that apply to the request. * * @return array|string> */ public function rules(): array { return [ 'name' => ['required', 'string', 'max:255'], ]; } }