试图使用Laravel 6.x Auth scaffold重新发送验证电子邮件,但我很难访问VerificationController@resend.
路线:列出
POST email/resend verification.resend AppHttpControllersAuthVerificationController@resend web,auth,throttle:6,1
按钮
<form action="{{route('verification.resend')}}" method="post">
<button type="submit" class="btn btn-primary">@lang('resend')</button>
</form>
但在VerificationController中没有"重新发送(("函数。所以我加了一个。
public function resend(Request $request)
{
dd('VerificationController@resend', $request);
// $user->sendEmailVerificationNotification();
}
但是dd((永远不会被击中。为什么不呢?
否则,电子邮件验证工作正常,我可以注册,收到初始验证电子邮件,然后单击该电子邮件中的按钮,验证用户。
它使用一个Trait。具体地说是IlluminateFoundationAuthVerifiesEmails
特性。
它有三种功能,本身还有另一个特点:
use RedirectsUsers;
public function show(Request $request)
public function verify(Request $request)
public function resend(Request $request)
请参阅https://github.com/laravel/framework/blob/6.x/src/Illuminate/Foundation/Auth/VerifiesEmails.php(6.x版本,7.x中更改了内容(