Found a work around which I'm not sure is the right thing to do. I realized that my getLogin()
isn't even called if the user is logged in, (I don't know why). So this is what I did.
In the AuthController.php\__construct()
:
if (\Auth::check())
{
return redirect()->intended('/dashboard');
}
and same two lines in the AuthController.php\getLogin()
:
if (\Auth::check())
{
return redirect()->intended('/dashboard');
}
Hope this helps.
You have to change the redirect value in handle method of app\Http\Middleware\RedirectIfAuthenticated.php
public function handle($request, Closure $next)
{
if ($this->auth->check()) {
return redirect('/home');
}
return $next($request);
}
it worked for me .apply this logic:
Route::get('/', ['middleware' => 'auth', function (){
if(Auth::check())
{
return redirect()->action('BrandController@index');
}
}]);
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community