To See last Executed query in Laravel 5 we need to enable query log of laravel.To Enable query log use "DB::enableQueryLog()" function before query. As we know DB::getQueryLog() function of laravel return all executed queries.To get last query we will use end() function which return last executed query.
$query = DB::getQueryLog(); $lastQuery = end($query);
Here is simple example.
DB::enableQueryLog(); $users= DB::select('select * from user where 1'); $query = DB::getQueryLog(); $lastQuery = end($query); print_r($lastQuery);
Array ( [query] => select * from user where 1 [bindings] => Array ( ) [time] => 0.39 )