mirror of
https://github.com/laravel/laravel.git
synced 2025-02-20 11:53:14 +08:00
remove things that aren't usually customized
This commit is contained in:
parent
396634857e
commit
134eafd12c
@ -3,8 +3,6 @@
|
|||||||
namespace App\Exceptions;
|
namespace App\Exceptions;
|
||||||
|
|
||||||
use Exception;
|
use Exception;
|
||||||
use Illuminate\Auth\AuthenticationException;
|
|
||||||
use Illuminate\Validation\ValidationException;
|
|
||||||
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
|
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
|
||||||
|
|
||||||
class Handler extends ExceptionHandler
|
class Handler extends ExceptionHandler
|
||||||
@ -52,33 +50,4 @@ class Handler extends ExceptionHandler
|
|||||||
{
|
{
|
||||||
return parent::render($request, $exception);
|
return parent::render($request, $exception);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Convert a validation exception into a JSON response.
|
|
||||||
*
|
|
||||||
* @param \Illuminate\Http\Request $request
|
|
||||||
* @param \Illuminate\Validation\ValidationException $exception
|
|
||||||
* @return \Illuminate\Http\JsonResponse
|
|
||||||
*/
|
|
||||||
protected function invalidJson($request, ValidationException $exception)
|
|
||||||
{
|
|
||||||
return response()->json([
|
|
||||||
'message' => $exception->getMessage(),
|
|
||||||
'errors' => $exception->errors(),
|
|
||||||
], $exception->status);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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'));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user