Handle Exceptions with json response in laravel
- php 5.5 >=
You can install this package throw the Composer by running:
composer require josh/restexcpetion
- you should use the RestException in Handler object
- The Exception Handler is here
app\Exceptions\Hanldler.php
class Handler extends ExceptionHandler
{
/**
* Use rest exception in class
*/
use \Josh\Exception\RestException;
- then call the renderRestException method in render method
return $this->renderRestException($request , $exception);
The MIT License (MIT). Please see License File for more information.