Filament: Table with Complex Filters

Table with multiple filters on top: comma-separated text input, dropdowns, and their layout.

18-table-with-complex-filters

Get the Source Code:

How it works

The whole filter logic is in the ProductResource resource tables filters() method.

The layout option FiltersLayout::AboveContent is added to show filters above the table.

The filtersFormColumns() method is added to show filters in a grid.

For searching code and name, the form is used with a TextInput. The query for this search is custom.

Before making a query, the explode() PHP function is used so that a comma can separate search values, and the array_map() function with trim is used to remove empty values.

Here is the code of how the query looks like for the code search (for name, it's the same, just a different variable):

->query(function ($query, array $data) {
return $query->when($data['code'], function (Builder $query, int|string $codeInput) {
 
// ...
The FULL tutorial is available after the purchase: in the Readme file of the official repository you would get invited to.
Get the Source Code: All 51 Premium Examples for $99 Only Table Examples for $39