How to show successful login message I am using Laravel 5 default login functionality and its works fine .
I only want's to how how can i show message when some user login with their name.
Let suppose Welcome back John Doe etc. When User Login On Home page ?
with successfull redirect send message
redirect('/')->with('success', 'You are successfully logged in');
on home page or in master blade layout add this
@if (Session::has('success'))
<div class="alert alert-warning alert-dismissible" role="alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
{{Session::get('success')}
</div>
@endif
@umefarooq How can i attach with with this one ?
public function redirectPath()
{
if (property_exists($this, 'redirectPath'))
{
return $this->redirectPath;
}
return property_exists($this, 'redirectTo') ? $this->redirectTo : '/';
}
its a function that redirect user to your specific path after login. How can i add with there ?
this method just returning value of redirect path show method which has redirect method
This one ?
public function handle($request, Closure $next)
{
if ($this->auth->check())
{
return new RedirectResponse(url('/dashboard'));
}
return $next($request);
}
Here you can add
return new RedirectResponse(url('/dashboard'))->with('success', 'You are successfully logged in');
Not working :( syntax error eccors
Try adding that with() method inside like:
return new RedirectResponse(url('/dashboard')->with('success', 'You are successfully logged in'));
@Ruffles error .Call to a member function with() on a non-object
better to try this
return redirect('/dashboard')->with('success', 'You are successfully logged in');
it work the same as RedirectResponse
Please sign in or create an account to participate in this conversation.