如果注冊后的第一個郵件沒有發送,我有一個簡單的功能,點擊即可向用戶發送電子郵件。但是當我單擊該按鈕時,它沒有任何反應,而是將我帶到主頁。重發函數: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 關注
- 127 瀏覽
添加回答
舉報
0/150
提交
取消