namespace AppExceptions;
use Exception;
use Request;
use IlluminateAuthAuthenticationException;
use Response;
use IlluminateFoundationExceptionsHandler as ExceptionHandler;
protected function unauthenticated($request, AuthenticationException $exception)
{
if ($request->expectsJson()) {
return response()->json(['error' => 'Unauthenticated.'], 401);
}
return redirect()->guest('/');
}