PHP code example of cblink / laravel-exception
1. Go to this page and download the library: Download cblink/laravel-exception library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
cblink / laravel-exception example snippets
namespace App\Exceptions;
use Exception;
use Cblink\LaravelException\BaseHandler;
// extends `Cblink\LaravelException\BaseHandler`
class Handler extends BaseHandler
{
// ...
/**
* Render an exception into an HTTP response.
*
* @param \Illuminate\Http\Request $request
* @param Exception $exception
*
* @return \Illuminate\Http\Response
*/
public function render($request, Exception $exception)
{
// parent::render($request, $exception)
// Change as follows
return $this->renderApi($request, $exception);
}
}
shell
php artisan vendor:publish --provider="Cblink\LaravelException\ExceptionServiceProvider"