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
echo ‘<pre>’;
print_r($queries);
echo ‘</pre>’;
[/php]
Leave a Reply