How to get last executed mysql query in Laravel?
In this post we will give you information about How to get last executed mysql query in Laravel?. Hear we will give you detail about How to get last executed mysql query in Laravel?And how to use it also give you demo for it if it is necessary.
If you are working on laravel framwork and you use query builder of laravel 5. but you want to get last executed mysql query from laravel. If you are working on laravel 5 then you have to first enable query log that way it can be store query log. At last getQueryLog() through you can get last executed query.
I give you example of how to get last executed mysql query. you can use example as following example.
public function querylog()
{
DB::enableQueryLog();
$item = Item::find(2);
$last_query = DB::getQueryLog();
print_r($last_query);
}
Try this………….
Hope this code and post will helped you for implement How to get last executed mysql query in Laravel?. if you need any help or any feedback give it in comment section or you have good idea about this post you can give it comment section. Your comment will help us for help you more and improve us. we will give you this type of more interesting post in featured also so, For more interesting post and code Keep reading our blogs