F
Filament6mo ago
Lietze

How to find the current query of the list page?

I have this page where i get 2236 results by default, but when i tinker with Model::count() i get 150 more results than my resource list.. to debug this i would like to see the query built to show the results, so i can figure out what i did wrong
4 Replies
Lietze
Lietze6mo ago
For people wondering, I found a solution the non-filament way: Added to boot() in AppServiceProvider.php:
\Event::listen('Illuminate\Database\Events\QueryExecuted', function ($query) {
logger([$query->sql, $query->bindings, $query->time]);
});
\Event::listen('Illuminate\Database\Events\QueryExecuted', function ($query) {
logger([$query->sql, $query->bindings, $query->time]);
});
You can find all queries per page logged in the laravel log files
DariusIII
DariusIII6mo ago
You could add getTableQuery override on list page and dump the original query results or its raw query.
Lietze
Lietze6mo ago
oh that's great! Will remember that one for next time 😄 TY!
DrByte
DrByte6mo ago
Laravel DebugBar will also show you the queries.