Make row from panel conditionnaly collapsible
I'm trying to make row from panel in table conditionally collapsible when the closure return true (record return count > 0 on relationship) from this code.
But a modification in filament is needed and i'm stuck (see screenshot)
Help !
But a modification in filament is needed and i'm stuck (see screenshot)
Help !
public static function table(Table $table): Table
{
return $table
->columns([
Split::make([
TextColumn::make('test.id')->label('idtest'),
TextColumn::make('test1')->label('test1'),
]),
Panel::make([
Stack::make([
//TextColumn::make('details.test_id')->label('testid'),
TextColumn::make('details.detail1')->label('detail1'),
TextColumn::make('details.detail2')->label('detail2'),
TextColumn::make('details.detail3')->label('detail3'),
])->collapsible( function(Model $record){
if($record->details()->count() > 0) {
return true;
}
else {
return false;
}
}),
])
])
->filters([
//
])
->actions([
Tables\Actions\EditAction::make(),
])
->bulkActions([
Tables\Actions\DeleteBulkAction::make(),
]);
} public static function table(Table $table): Table
{
return $table
->columns([
Split::make([
TextColumn::make('test.id')->label('idtest'),
TextColumn::make('test1')->label('test1'),
]),
Panel::make([
Stack::make([
//TextColumn::make('details.test_id')->label('testid'),
TextColumn::make('details.detail1')->label('detail1'),
TextColumn::make('details.detail2')->label('detail2'),
TextColumn::make('details.detail3')->label('detail3'),
])->collapsible( function(Model $record){
if($record->details()->count() > 0) {
return true;
}
else {
return false;
}
}),
])
])
->filters([
//
])
->actions([
Tables\Actions\EditAction::make(),
])
->bulkActions([
Tables\Actions\DeleteBulkAction::make(),
]);
}