public static function getTableFilters():array
{
return [
//this working fine
Tables\Filters\SelectFilter::make('customer_id')
->label(CustomerResource::getLabelForNameAttribute())
->options(fn() => Customer::getDistinctCustomersFromModelOptionsByRole(static::getModel()))
->preload(),
//few 5-10 seconds to load after open filter
Tables\Filters\Filter::make('custom')
->columnSpanFull()
->columns()
->form([
Select::make('customer_id')
->label(CustomerResource::getLabelForNameAttribute())
->live()
->options(fn() => Customer::getDistinctCustomersFromModelOptionsByRole(static::getModel()))
->preload()
->afterStateUpdated(fn (Set $set) => $set('branch_id', null)),
public static function getTableFilters():array
{
return [
//this working fine
Tables\Filters\SelectFilter::make('customer_id')
->label(CustomerResource::getLabelForNameAttribute())
->options(fn() => Customer::getDistinctCustomersFromModelOptionsByRole(static::getModel()))
->preload(),
//few 5-10 seconds to load after open filter
Tables\Filters\Filter::make('custom')
->columnSpanFull()
->columns()
->form([
Select::make('customer_id')
->label(CustomerResource::getLabelForNameAttribute())
->live()
->options(fn() => Customer::getDistinctCustomersFromModelOptionsByRole(static::getModel()))
->preload()
->afterStateUpdated(fn (Set $set) => $set('branch_id', null)),