/** * Inspect a route. * * @param Client $client * @param string $route */ protected function inspect(Client $client, $route) { try { $this->info('Inspecting ' . $route); $client->request('GET', $route); } catch (Exception $exception) { $this->error('Error inspecting ' . $route); } // Format and sort queries $routeQueries = DB::getQueryLog(); $routeQueries = array_pluck($routeQueries, 'query'); sort($routeQueries); // Cancel if no queries on this page if (empty($routeQueries)) { return; } // Store and flush $this->queries[$route]['response'] = $client->getResponse()->getContent(); $this->queries[$route]['queries'] = $routeQueries; DB::flushQueryLog(); }