Skip to content

Commit

Permalink
add default unauthenticated stub method
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Jul 19, 2017
1 parent c5ac749 commit 11b0de0
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/Illuminate/Foundation/Exceptions/Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,20 @@ protected function prepareException(Exception $e)
return $e;
}

/**
* Convert an authentication exception into a response.
*
* @param \Illuminate\Http\Request $request
* @param \Illuminate\Auth\AuthenticationException $exception
* @return \Illuminate\Http\Response
*/
protected function unauthenticated($request, AuthenticationException $exception)
{
return $request->expectsJson()
? response()->json(['message' => 'Unauthenticated.'], 401)
: redirect()->guest(route('login'));
}

/**
* Create a response object from the given validation exception.
*
Expand Down

0 comments on commit 11b0de0

Please sign in to comment.