F
Filament13mo 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
_LietzeOP13mo 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
DariusIII13mo ago
You could add getTableQuery override on list page and dump the original query results or its raw query.
_Lietze
_LietzeOP13mo ago
oh that's great! Will remember that one for next time 😄 TY!
DrByte
DrByte13mo ago
Laravel DebugBar will also show you the queries.

Did you find this page helpful?