Query builder what were you thinking?!

A handy code snippet for finding out exactly what sql the Laravel 4 query builder was trying to run:

$queries = DB::getQueryLog();
$last_query = end($queries);
dd($last_query);

EDIT -14/11/2013

Or, an even better option - install https://github.com/barryvdh/laravel-debugbar - and easily access all the DB queries run for a given page.

Comments