show laravel sql query code example
Example 1: show query in laravel
Use the toSql() method on a QueryBuilder instance.
DB::table('users')->toSql()
Example 2: laravel sql query
use Illuminate\Support\Facades\DB;
$users = DB::select('select * from users');
foreach ($users as $user) {
echo $user->name;
}