Toggleable and Filter Tab

I am trying to make the relation of column visibility and filter tab in filament table. I have staff tab in ListRecord like that
'staff' => Tab::make(trans('tab.staff'))
->modifyQueryUsing(fn (Builder $query)
=> $query->whereNotNull('staffID'))
->icon('heroicon-m-identification'),
'staff' => Tab::make(trans('tab.staff'))
->modifyQueryUsing(fn (Builder $query)
=> $query->whereNotNull('staffID'))
->icon('heroicon-m-identification'),
When user click this tab I want to the staff coloumn in filament table. How can I?
1 Reply
Shaung Bhone
Shaung BhoneOP14mo ago
Here is how I made? That's not working. I'm dump.
public static function table(Table $table): Table
{
$tab = Tab::make(trans('tab.staff'))
->modifyQueryUsing(fn (Builder $query)
=> $query->whereNotNull('staffID'))
->icon('heroicon-m-identification');
//
//
Tables\Columns\TextColumn::make('staffID')
->toggleable(
isToggledHiddenByDefault: $tab->getLabel() === trans('tab.staff') ? true : false
)
public static function table(Table $table): Table
{
$tab = Tab::make(trans('tab.staff'))
->modifyQueryUsing(fn (Builder $query)
=> $query->whereNotNull('staffID'))
->icon('heroicon-m-identification');
//
//
Tables\Columns\TextColumn::make('staffID')
->toggleable(
isToggledHiddenByDefault: $tab->getLabel() === trans('tab.staff') ? true : false
)
Want results from more Discord servers?
Add your server