如何在Laravel 5.7 Multiple Guards上验证电子邮件?

时间:2019-05-23 10:24:26

标签: laravel

我正在使用多个警卫,并希望使用Laravel内置系统来发送验证电子邮件。我正在关注

'guards' => [
    'web' => [
        'driver' => 'session',
        'provider' => 'users',
    ],

    'frontEnd' => [
        'driver' => 'session',
        'provider' => 'customers',
    ],

    ...
],

'providers' => [
    'users' => [
        'driver' => 'eloquent',
        'model' => App\User::class,
    ],

    'customers' => [
        'driver' => 'eloquent',
        'model' => App\Customer::class,
    ],

    ...
],

在用户模型和客户模型中,我正在使用MustVerifyEmail。两个模型都有email_verified_at列。当我创建用户时,当该用户尝试登录时,他将重定向到电子邮件/验证路由。创建用户时不会触发电子邮件。

由于某些原因,我没有使用Auth :: routes(['verify'=> true]);我放了

Route::get('email/verify', 'Auth\VerificationController@show')->name('verification.notice');
Route::get('email/verify/{id}', 'Auth\VerificationController@verify')->name('verification.verify');

Route::get('email/resend', 'Auth\VerificationController@resend')->name('verification.resend');

在route / web.php文件上

0 个答案:

没有答案