Log last executed Eloquent query as plain SQL in Laravel 5
Here's the small code snippet needed to quickly log the SQL output for your last executed Eloqent query in Laravel 5. I've had to look this up so many times, that I decided to just post it here for my own convenience. If you forget to enable the query log, you'll notice that it will be empty all the time.
\DB::connection()->enableQueryLog();
$query = \DB::getQueryLog();
$lastQuery = end($query);