Laravel
Laravel

How to print query in laravel?

Print query in laravel

126Views

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.

 

Ajay Malhotra
the authorAjay Malhotra
Hello to all. Welcome to therichpost.com. Myself Ajay Malhotra and I am full stack developer. I love coding. I know Wordpress, Core php, Angularjs, Angular 2, Angular 6, laravel, Codeigniter, Shopify, Squarespace, Jquery, GoogleMapApi Vuejs, Reactjs, Bigcommerce etc.

1 Comment

Leave a Reply