route('user')); } /** * Prepare the data for validation. * * @return void */ protected function prepareForValidation() { /** @var User */ $userModel = $this->route('user'); $this->merge([ 'published' => $this->boolean('published'), 'password' => $this->input( 'password', ) ?? $userModel->password, 'password_confirmation' => $this->input( 'password_confirmation' ) ?? $userModel->password, ]); } /** * Get the validation rules that apply to the request. */ public function rules(): array { /** @var User */ $userModel = $this->route('user'); return array_merge(parent::rules(), [ 'email' => [ 'required', 'email:rfc,strict,dns,spoof,filter', Rule::unique('users', 'email')->ignore($userModel->getRouteKey()), ], 'password' => [ 'required', 'required_with:password_confirmation', 'confirmed', 'max:255', Password::min(8) ->letters() ->mixedCase() ->numbers() ->symbols() ->uncompromised(), ], ]); } }