show query in laravel
snippet in php

print last sql query laravel

user5593

DB::enableQueryLog(); // Enable query log

// Your Eloquent query executed by using get()

dd(DB::getQueryLog()); // Show results of log

show query in laravel

user9733

Use the toSql() method on a QueryBuilder instance.

DB::table('users')->toSql()