I'm using laravel 5.0 and I'm trying to check if the user is authenticated. If he is, then he can proceed to the page. But if he is NOT authenticated, I wan to redirect him to my login page. Can't figure out what's wrong:
No idea why, but php artisan make:auth gives me nothing but error. I'm implementing my own "auth system". Guess I found the problem: App/Http/Middleware/Authenticate.php
public function handle($request, Closure $next)
{
if ($this->auth->guest())
{
if ($request->ajax())
{
return response('Unauthorized.', 401);
}
else
{
return redirect()->guest('/login'); <- I JUST EDITED THIS
}
}
return $next($request);
}