如果用户未通过电子邮件链接验证其帐户,则显示“请先验证电子邮件,然后再登录我的登录刀片”。
if ($user->is_verified == 0) {
$request->session()->flash("failed", "Please verify your email before login );
return redirect('/login');
}
我喜欢用刀片抓住它
@if (Session::has('failed'))
<div class="alert alert-danger">
{{Session::get('failed')}}.<br><br>
</div>
@endif
但是,现在我必须添加此消息。请先验证您的电子邮件,然后再登录或重新发送验证电子邮件,并重新发送带有href的部分路由。有任何想法吗 ?
使用此代码
在route.php中添加一条路线
Route::get('/resend_mail', 'VerificationMailController@resend'); //replace with your desired location
在VerificationMailController.php中
public function resend(){
//do your resend verification mail code
}
比在您要显示重新发送消息的地方使用此代码
if ($user->is_verified == 0) {
$resendurl = route('resend_mail'); //here replace the route of your email verification send route.
$msg = 'Please verify your email before login or <a href="'.$resendurl.'">resend</a> the verification email';
$request->session()->flash("failed", $msg);
return redirect('/login');
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句