/** * Log the query into the internal store * * @return array */ public function registerQuery($query, $bindings, $time, $connection) { $currentTime = microtime(true); $explainResults = []; if (preg_match('/^(SELECT) /i', $query)) { $pdo = DB::connection($connection)->getPdo(); $statement = $pdo->prepare('EXPLAIN ' . $query); $statement->execute($bindings); $explainResults = $statement->fetchAll(\PDO::FETCH_CLASS); foreach ($explainResults as $key => $value) { $explainResults[$key] = (array) $value; } } $this->queries[] = array('query' => $query, 'bindings' => $bindings, 'time' => $time, 'connection' => $connection, 'explain' => $explainResults); \Clockwork::addEvent(uniqid('query_'), 'Sql query', $currentTime - $time / 1000, $currentTime, ['query' => $query, 'bindings' => $bindings]); }
$app->register(App\Providers\AppServiceProvider::class); $app->register(App\Providers\EventServiceProvider::class); $app->register(Clockwork\Support\Lumen\ClockworkServiceProvider::class); $app->register(App\Providers\AclProvider::class); $app->register(Appzcoder\LumenRoutesList\RoutesCommandServiceProvider::class); $app->register(LucaDegasperi\OAuth2Server\Storage\FluentStorageServiceProvider::class); $app->register(LucaDegasperi\OAuth2Server\Lumen\OAuth2ServerServiceProvider::class); $app->register(Barryvdh\Cors\LumenServiceProvider::class); $app->register(TwigBridge\ServiceProvider::class); $app->configure('profiler'); $app->configure('oauth2'); $app->configure('cors'); $app->configure('twigbridge'); /* |-------------------------------------------------------------------------- | Load The Application Routes |-------------------------------------------------------------------------- | | Next we will include the routes file so that they can all be added to | the application. This will provide all of the URLs the application | can respond to, as well as the controllers that may handle them. | */ if (!class_exists('Authorizer')) { class_alias(\LucaDegasperi\OAuth2Server\Facades\Authorizer::class, 'Authorizer'); } $app->group(['namespace' => 'App\\Http\\Controllers'], function ($app) { require __DIR__ . '/../app/Http/routes.php'; }); Clockwork::addEvent('app.bootstrap', 'App bootstraping', $startBootstraping, microtime(true)); return $app;