我想在电子邮件验证后向用户显示一条消息。在新用户注册网站后获得电子邮件到电子邮件的验证。存在一个版本控制器。如何修改以获得通知?
<?php
namespace AppHttpControllersAuth;
use IlluminateHttpRequest;
use AppHttpControllersController;
use AppProvidersRouteServiceProvider;
use IlluminateFoundationAuthVerifiesEmails;
class VerificationController extends Controller
{
/*
|--------------------------------------------------------------------------
| Email Verification Controller
|--------------------------------------------------------------------------
|
| This controller is responsible for handling email verification for any
| user that recently registered with the application. Emails may also
| be re-sent if the user didn't receive the original email message.
|
*/
use VerifiesEmails;
/**
* Where to redirect users after verification.
*
* @var string
*/
protected $redirectTo = RouteServiceProvider::HOME;
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('auth');
$this->middleware('signed')->only('verify');
$this->middleware('throttle:6,1')->only('verify', 'resend');
}
}
您可以像这样执行override
verified
函数。
protected function verified(Request $request)
{
$request->session()->flash('alert','You message here');
}
当用户将被验证时,这将添加一个会话,然后在您重定向的地方,您可以从Session
获得消息并显示消息。
像这样:
@if(Session::has('alert'))
<p class="alert {{ Session::get('alert-class', 'alert-info') }}">
{{ Session::get('alert') }}
</p>
@endif