Package Data | |
---|---|
Maintainer Username: | fitztrev |
Package Create Date: | 2016-05-09 |
Package Last Update: | 2016-05-22 |
Home Page: | |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-11-15 03:04:29 |
Package Statistics | |
---|---|
Total Downloads: | 17,966 |
Monthly Downloads: | 172 |
Daily Downloads: | 9 |
Total Stars: | 229 |
Total Watchers: | 7 |
Total Forks: | 5 |
Total Open Issues: | 2 |
Find exactly where a specific database query is being called in your Laravel application.
Want to optimize or debug your database queries but not sure where they're being called? See how it works below with Clockwork:
If you use Debugbar, it has this functionality built-in if you set debugbar.options.db.backtrace
to true
.
Install via composer:
composer require fitztrev/query-tracer
Add the service provider to your config/app.php
:
'providers' => [
// ...
Fitztrev\QueryTracer\Providers\QueryTracerServiceProvider::class,
],
It makes use of Laravel's global query scopes to do a backtrace and find where a query originated. Then it puts that info in extraneous but helpful WHERE
clauses.
By default, it's only enabled when debug
is on. You can change this behavior for specific models by adding an enableQueryTracer()
method to your model(s). For example:
public function enableQueryTracer()
{
return config('app.env') == 'local';
}