Sesh
Select filter grouping options in relation filter
This is my current code that works for me:
Filter::make('productCategories')
->form([
Select::make('productCategories')
->label(__('Product Categories'))
->multiple()
->preload()
->optionsLimit(150)
->options(
$groupedProductCategories
),
])
->query(function (Builder $query, array $data): Builder {
return $query
->when(
$data['productCategories'],
fn (Builder $query, $productCategories): Builder => $query->whereHas(
'productCategories',
function ($q) use ($productCategories) {
$q->whereIn('product_categories.id', $productCategories);
}
)
);
})
9 replies
Arranging records into a grid does not work
Wrap it like this: https://filamentphp.com/docs/3.x/tables/layout#allowing-columns-to-stack-on-mobile
8 replies
Select filter grouping options in relation filter
The data is in this form (as described in the doc at https://filamentphp.com/docs/3.x/forms/fields/select#grouping-options):
If I use ->relationship() it takes the options from the relation and not from the grouped options.
9 replies
How to change style of card when arranged to grid?
Thanks @pboivin . Below is what I ended for white cards on a blank background and also all the gray background on the filter and sort elements removed. Maybe it helps someone. I will create a PR soon to add the classes which should make this easier.
11 replies