如果注册后的第一个邮件没有发送,我有一个简单的功能,点击即可向用户发送电子邮件。但是当我单击该按钮时,它没有任何反应,而是将我带到主页。重发函数:protected function resend() { $user = Account::where('email', Auth::user()->email)->first(); $user->verifyToken = Str::random(40); $user->save(); $this->sendEmail($user); return redirect(route('verifyEmail'))->with('user',$user)->with('success', 'A link has been sent to your email'); }Route::post('/resend/email', 'Auth\RegisterController@resend')->name('resendEmail');html:<form action=" {!! route('resendEmail') !!}" method="POST"> @csrf <button class="btn btn-default" type="submit" value="Submit">Resend Verification Link</button></form>通过添加到构造函数修复了中间件问题: $this->middleware('auth', ['except' => ['resendEmail']]);
1 回答
HUX布斯
TA贡献1876条经验 获得超6个赞
RegisterController
在__construct方法上添加以下内容:
$this->middleware('auth', ['except' => ['account/security/resend/email']]);
- 1 回答
- 0 关注
- 90 浏览
添加回答
举报
0/150
提交
取消