Laravel4旧的调试页面

时间:2015-04-29 13:04:24

标签: laravel laravel-5

如何在laravel 5调试器中获取laravel 4调试器页面 页

enter image description here

这里

enter image description here

1 个答案:

答案 0 :(得分:1)

安装whoops包:

composer require filp/whoops

然后通过编辑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()
        );
    }

}