credentials(), function ($user, $password) { $this->resetPassword($user, $password); }); return match ($response) { Password::PASSWORD_RESET, Password::INVALID_USER => $this->respondWithSuccess(), default => $this->setStatusCode(400) ->respondWithError(trans($response)), }; } /** * Reset the given user's password. */ protected function resetPassword(\Illuminate\Contracts\Auth\CanResetPassword $user, string $password): void { $user->password = $password; $user->save(); event(new PasswordReset($user)); } }