How to get last executed mysql query in laravel ?By Hardik Savani | January 11, 2016 | | 1037 Viewer | Category : Laravel MySql
Share this post:
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()
$item = Item::find(2);
$last_query = DB::getQueryLog();
- PHP: How to count files in folder?
- Laravel 5 query builder where exists example
- Select box with search option example in Jquery using Chosen Plugin
- How to check table is exists or not in Laravel 5?
- Laravel 5 - Class 'Input' not found issue?
- Laravel after login, redirect back to previous url ?
- How to create and check custom header with middleware for REST API in Laravel 5 ?
- PHP - jquery ajax crop image before upload using croppie plugin