我正在使用多个警卫,并希望使用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文件上