how to create a flash message when a user successfully logged in on fortify? later in the blade view I just need to call using
@if(session()->has('success-login'))
<div role="alert">
<strong>{{ session()->get('success-login') }}</strong>
<button type="button" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
@endif
CodePudding user response:
According to laravel document you can use the with
method and redirect to your custom page with a flash message.
public function register()
{
$this->app->instance(LoginResponse::class, new class implements LoginResponse {
public function toResponse($request)
{
return redirect('/')->with('success-login', 'message');
}
});
}