1

我正在尝试在 Lumen 5.3 中创建 PasswordReset API。

我从默认的 Laravel 5.3 应用程序中进行了相同的设置。

$app->post('/password/email', 'PasswordController@postEmail');
$app->post('/password/reset/{token}', 'PasswordController@postReset');

在用户模型中,我重写了该方法,如下所示:

public function sendPasswordResetNotification($token)
{
        $this->notify(new ResetPasswordNotification($token));
}

我已经手动拉入 Lumen 5.3 的通知包

但是,我收到以下错误:

BindingResolutionException in Container.php line 763:
Target [Illuminate\Contracts\Mail\Mailer] is not instantiable while building [Illuminate\Notifications\Channels\MailChannel].

我在这里想念什么?

4

1 回答 1

0

将以下行添加到您的bootstrap/app.php

$app->alias('mailer', \Illuminate\Contracts\Mail\Mailer::class);
于 2017-08-25T09:44:41.253 回答