Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Laravel Call to undefined method App\Exceptions\Handler::unauthenticated()
* Convert an authentication exception into an unauthenticated response.
* @param \Illuminate\Http\Request $request
* @param \Illuminate\Auth\AuthenticationException $exception
* @return \Illuminate\Http\Response
protected function unauthenticated($request, AuthenticationException $exception)
if ($request->expectsJson()) {
return response()->json(['error' => 'Unauthenticated.'], 401);
return redirect()->guest('login');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment