public function handle($request, Closure $next)
 {
     try {
         $response = $next($request);
     } catch (\Exception $e) {
         $this->exceptionHandler->report($e);
         $response = $this->exceptionHandler->render($request, $e);
     }
     return Helper::appendDebugbar($request, $response);
 }
 public function logQuery($sql, $bindings, $time, $connectionName, $db, $connection, $pdo)
 {
     $runnableSql = $this->createRunnableSql($sql, $bindings);
     $dumpSql = $this->dumpSql($runnableSql);
     $explain = [];
     if ($connection->getDriverName() === 'mysql') {
         $explain = $this->getExplain($sql, $bindings, $pdo);
     }
     $editorLink = Helper::getEditorLink(Helper::findSource());
     $this->attributes['count']++;
     $this->attributes['totalTime'] += $time;
     $this->attributes['queries'][] = compact('runnableSql', 'dumpSql', 'explain', 'time', 'name', 'editorLink');
 }
Beispiel #3
0
 protected function convertExceptionToResponse(Exception $e)
 {
     // $debug = config('app.debug');
     // if ($debug === false) {
     //     return (new SymfonyDisplayer(config('app.debug')))->createResponse($e);
     // }
     $statusCode = 500;
     $headers = [];
     if ($e instanceof HttpException === true) {
         $statusCode = $e->getStatusCode();
         $headers = $e->getHeaders();
     }
     return response(Helper::getBlueScreen($e), $statusCode, $headers);
 }
Beispiel #4
0
 public function subscribe()
 {
     $key = get_class($this);
     $timer = Debugger::timer($key);
     $event = $this->app['events'];
     $event->listen('*', function ($params) use($key, $event) {
         $execTime = Debugger::timer($key);
         $firing = $event->firing();
         $editorLink = Helper::getEditorLink(Helper::findSource());
         $this->attributes['count']++;
         $this->attributes['totalTime'] += $execTime;
         $this->attributes['logs'][] = compact('execTime', 'firing', 'params', 'editorLink');
     });
 }
 public function subscribe(Dispatcher $event)
 {
     $key = get_class($this);
     $timer = Debugger::timer($key);
     $event->listen('*', function ($params) use($key, $event) {
         $execTime = Debugger::timer($key);
         // $dispatcher = static::findDispatcher();
         // $firing = array_get($dispatcher, 'dispatcher.args.0');
         $firing = $event->firing();
         $editorLink = Helper::getEditorLink(Helper::findSource());
         $this->attributes['totalTime'] += $execTime;
         $this->attributes['events'][] = compact('execTime', 'firing', 'params', 'editorLink');
     });
 }
Beispiel #6
0
 public function logQuery($prepare, $bindings, $time, $name, $connection)
 {
     $driver = $connection->getDriverName();
     $pdo = $connection->getPdo();
     $version = $pdo->getAttribute(PDO::ATTR_SERVER_VERSION);
     $sql = static::prepareBinding($prepare, $bindings);
     $formattedSql = static::formatSql($sql);
     $hints = static::performQueryAnalysis($sql, $version, $driver);
     $editorLink = Helper::getEditorLink(Helper::findSource());
     $explains = [];
     if ($driver === 'mysql') {
         $explains = $this->explains($prepare, $bindings, $pdo);
     }
     $this->attributes['count']++;
     $this->attributes['totalTime'] += $time;
     $this->attributes['logs'][] = compact('sql', 'formattedSql', 'hints', 'explains', 'editorLink', 'prepare', 'bindings', 'time', 'name');
 }