Skip to content

Commit

Permalink
getting executed sql querie from the QueryLog
Browse files Browse the repository at this point in the history
  • Loading branch information
Gadoma committed Sep 3, 2013
1 parent db2836e commit 52bbb87
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion database.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,9 @@ Sometimes you may need to reconnect to a given database:

By default, Laravel keeps a log in memory of all queries that have been run for the current request. However, in some cases, such as when inserting a large number of rows, this can cause the application to use excess memory. To disable the log, you may use the `disableQueryLog` method:

DB::connection()->disableQueryLog();
DB::connection()->disableQueryLog();

To get the executed queries from the log, it is possible to do so

$queries = DB::getQueryLog();
$last_query = end($queries);

0 comments on commit 52bbb87

Please sign in to comment.