Laravel debug query

Code Examples, Laravel

Laravel debug query

DB::enableQueryLog();
$users = User::whereIn('id', [1, 2, 3])->get();
$queries = DB::getQueryLog();
dd($queries);

$query = DB::table('users')->toSql();
dd($query);

click for more Laravel codes read about laravel query builders