Issue on filament tables grouping rows when upgrade from v3 to v4.
How to group the record which value may or may not be always present on table.
Row grouping code:
Group::make('unscopedParent.name')
->label('Parent Client')
->collapsible(),
Table column:
TextColumn::make('unscopedParent.name')
->hiddenOn(ManageChildClients::class)
->label('Parent')
->url(function ($record, TextColumn $column) {
$record->load('parent');
if (Tenant::user()->can('view_client') && $record->parent) {
FilamentHelper::applyUrlStyle($column);
return ClientResource::getUrl('child-clients', [
'record' => $record->parent_id,
]);
}
})
->numeric()
->sortable(),
Relation in model:
/
* @return BelongsTo<Client, $this>
/
public function parent(): BelongsTo
{
return $this->belongsTo(Client::class, 'parent_id');
}
/
* @return BelongsTo<Client, $this>
/
public function unscopedParent(): BelongsTo
{
return $this->parent()->withoutGlobalScopes();
}

1 Reply
Please open an issue on GitHub with a reproduction repository