部署到AWS时,Laravel应用程序停止工作



我有一个Laravel应用程序,在本地机器中工作正常,当我将其部署到AWS时,我会遇到错误。我遇到错误的一部分是以下内容。我的应用程序具有创建新用户的管理用户,当创建用户时,将通过链接发送电子邮件给他们,并供他们选择密码。问题是他们在单击帖子时选择密码,我会收到以下错误。

我本地机器上的PHP版本为7.2.3 Windows。AWS具有7.2.13弹性豆刺

Argument 2 passed to IlluminateAuthPasswordsPasswordBroker::__construct() must implement interface IlluminateContractsAuthUserProvider, null given, called in /var/app/current/vendor/laravel/framework/src/Illuminate/Auth/Passwords/PasswordBrokerManager.php on line 75

该帖子的相关代码如下:

public function reset(Request $request)
    {
        $request->validate($this->rules(), $this->validationErrorMessages());

        // Here we will attempt to reset the user's password. If it is successful we
        // will update the password on an actual user model and persist it to the
        // database. Otherwise we will parse the error and return the response.
        $response = $this->broker()->reset(
            $this->credentials($request), function ($user, $password) {
                $this->resetPassword($user, $password);
            }
        );
        // If the password was successfully reset, we will redirect the user back to
        // the application's home authenticated view. If there is an error we can
        // redirect them back to where they came from with their error message.
        return $response == Password::PASSWORD_RESET
                    ? $this->sendResetResponse($request, $response)
                    : $this->sendResetFailedResponse($request, $response);
    }
    protected function rules()
    {
        return [
            'token' => 'required',
            'email' => 'required|email',
            'password' => 'required|confirmed|min:8',
        ];
    }
    /**
     * Get the password reset validation error messages.
     *
     * @return array
     */
    protected function validationErrorMessages()
    {
        return [];
    }
    /**
     * Get the password reset credentials from the request.
     *
     * @param  IlluminateHttpRequest  $request
     * @return array
     */
    protected function credentials(Request $request)
    {
        return $request->only(
            'email', 'password', 'password_confirmation', 'token'
        );
    }
    /**
     * Reset the given user's password.
     *
     * @param  IlluminateContractsAuthCanResetPassword  $user
     * @param  string  $password
     * @return void
     */
    protected function resetPassword($user, $password)
    {
        $user->password = Hash::make($password);
        $user->setRememberToken(Str::random(60));
        $user->save();
        event(new PasswordReset($user));
        $this->guard()->login($user);
    }
    /**
     * Get the response for a successful password reset.
     *
     * @param  IlluminateHttpRequest  $request
     * @param  string  $response
     * @return IlluminateHttpRedirectResponse|IlluminateHttpJsonResponse
     */
    protected function sendResetResponse(Request $request, $response)
    {
        return redirect($this->redirectPath())
                            ->with('status', trans($response));
    }
    /**
     * Get the response for a failed password reset.
     *
     * @param  IlluminateHttpRequest  $request
     * @param  string  $response
     * @return IlluminateHttpRedirectResponse|IlluminateHttpJsonResponse
     */
    protected function sendResetFailedResponse(Request $request, $response)
    {
        return redirect()->back()
                    ->withInput($request->only('email'))
                    ->withErrors(['email' => trans($response)]);
    }
    /**
     * Get the broker to be used during password reset.
     *
     * @return IlluminateContractsAuthPasswordBroker
     */
    public function broker()
    {
        return Password::broker('newusers');
    }
    /**
     * Get the guard to be used during password reset.
     *
     * @return IlluminateContractsAuthStatefulGuard
     */
    protected function guard()
    {
        return Auth::guard();
    }

检查您的配置auth.php文件。提出错误的代码是此

return new PasswordBroker(
    $this->createTokenRepository($config),
    $this->app['auth']->createUserProvider($config['provider'] ?? null)
);

第二个参数为null,也许是因为缺少配置?

相关内容

最新更新