Hello to all, welcome to therichpost.com. In this post, I will tell you, How to print query in laravel? Like I always say that laravel is the best Mvc php framework.
Here is the working code to print query in laravel:
DB::enableQueryLog();
$user = DB::table('user')->where('email','!=','test')->get();
$query = DB::getQueryLog();
$query = end($query);
print_r($query);
die();
or, you can try this one also:
$user = DB::table('user')->where('email','!=','test')->toSql();
dd($user);
if you have any query related this post then please do ask.

Very helpful