This content originally appeared on DEV Community and was authored by Ariel Mejia
Filament Resources allow to create quickly tables by mapping objects, it allows to add easily pretty common features like:
- sortable
- searchable
- and more features
in this case to debug the search query we can check the List class that is created by default when a user creates a filament resource, eg:
User Resource
class UserResource extends Resource
{
protected static ?string $model = User::class;
public static function getPages(): array
{
return [
'index' => ListUsers::route('/'),
// ... more pages
];
}
}
ListUsers
Here we can override a getFilteredTableQuery
method to check the raw sql and debug the query
protected function getFilteredTableQuery(): Builder
{
dd(parent::getFilteredTableQuery()->toRawSql());
}
Hope it is useful & Happy Coding!
This content originally appeared on DEV Community and was authored by Ariel Mejia
Ariel Mejia | Sciencx (2024-06-20T06:18:20+00:00) Debug Filament Search Query. Retrieved from https://www.scien.cx/2024/06/20/debug-filament-search-query/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.