App\Exceptions\Handler::render PHP Method

render() public method

Render an exception into an HTTP response.
public render ( Illuminate\Http\Request $request, Exception $e ) : Illuminate\Http\Response
$request Illuminate\Http\Request
$e Exception
return Illuminate\Http\Response
    public function render($request, Exception $e)
    {
        if ($e instanceof ModelNotFoundException) {
            $e = new NotFoundHttpException($e->getMessage(), $e);
        }
        return parent::render($request, $e);
    }

Usage Example

 public function testNotFoundRender()
 {
     $path = base_path('tests/storage/logs/report.log');
     \Log::useFiles($path);
     $exception = new \Illuminate\Database\Eloquent\ModelNotFoundException();
     $exception->setModel('Testing');
     $response = $this->handler->render($this->app['request'], $exception);
     $this->assertSame(404, $response->getStatusCode());
     $this->beforeApplicationDestroyed(function () use($path) {
         \File::delete($path);
     });
 }
All Usage Examples Of App\Exceptions\Handler::render