How to get last executed mysql query in laravel ?By Hardik Savani | January 11, 2016 | | 1217 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();
- Laravel 5 and Vue JS CRUD with Pagination example and demo from scratch
- Laravel 5 - Implement Flash Messages with example
- Laravel 5 generate sitemap using roumen/sitemap package Example
- How to get current route name in Laravel 5?
- Laravel 5 client side validation using Parsley.js example
- Laravel 5 - How to convert file(image, audio, video) extension using CloudConvert?
- Laravel 5 Autocomplete using Bootstrap Typeahead JS Example with Demo
- Laravel 5 - Generate Captcha code and Validation example using BotDetect package