log
-
(PHP) Get a list of run database queries in Laravel
This is great if you want to see what queries are actually run when using Eloquent. [php] // Get all querys run $queries = DB::getQueryLog(); // If you want to sort them by time this works usort($queries, function ($a, $b) { return $a[‘time’] < $b[‘time’]; }); // Print them on screen in a readable way…
-
(PHP) Log Laravel execution time to console
Put this in app/start/global.php to get Laravels execution time to the browser console log. L4 [php] $start = microtime(true); App::finish(function() use ($start) { echo "<script>console.log(‘App finish: ".round((microtime(true) – $start) * 1000, 3)." ms’)</script>"; }); [/php] This works with L5: [html] This page took {{ (microtime(true) – LARAVEL_START) }} seconds to render [/html]