sujit prasad
sujit prasad

Reputation: 945

Laravel4 old debug page

How can I get the laravel 4 debugger page in laravel 5 debugger page

enter image description here

here

to

enter image description here

Upvotes: 0

Views: 323

Answers (1)

Antonio Carlos Ribeiro
Antonio Carlos Ribeiro

Reputation: 87759

Install the whoops package:

composer require filp/whoops

Then use it to render your exceptions by editing your app/Exceptions/Handler.php:

<?php namespace App\Exceptions;

use Exception;
use Whoops\Run as Whoops;
use Illuminate\Http\Response;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use PragmaRX\Sdk\Services\ExceptionHandler\Service\Facade as SdkExceptionHandler;

class Handler extends ExceptionHandler {

    protected $dontReport = [
        'Symfony\Component\HttpKernel\Exception\HttpException'
    ];

    public function report(Exception $e)
    {
        return parent::report($e);
    }

    public function render($request, Exception $e)
    {
        if ($this->isHttpException($e))
        {
            return $this->renderHttpException($e);
        }

        if (env('APP_DEBUG'))
        {
            return $this->whoops($e);
        }

        return parent::render($request, $e);
    }

    protected function whoops(Exception $e)
    {
        $handled = with(new Whoops)
                    ->pushHandler(new \Whoops\Handler\PrettyPageHandler())
                    ->handleException($e);

        return new Response(
            $handled,
            $e->getStatusCode(),
            $e->getHeaders()
        );
    }

}

Upvotes: 1

Related Questions