F
Filament6mo ago
ruddy

Change the label of all page summary in the table.

I apologize if this has been asked before, but I couldn't find it. Does anyone have an idea of how I can change this name? Here is a screenshot.
No description
7 Replies
jaocero
jaocero6mo ago
->getStateUsing(fn() => 'New Name')
ruddy
ruddy6mo ago
ooh it doesn't work
ChesterS
ChesterS6mo ago
What does this do Sum::make()->label('Your label') ?
ruddy
ruddy6mo ago
I have attempted the suggested solution, but it seems to change only the label of the column rather than the label of the row. I have attached a screenshot for reference. What I need is for all payments to be labeled as 'All Total.
Tables\Columns\TextColumn::make('total')
->searchable(false)
->summarize(Sum::make()->label('Total')->extraAttributes(['class' => 'font-black'])->money('gbp'))
->money(),
Tables\Columns\TextColumn::make('total')
->searchable(false)
->summarize(Sum::make()->label('Total')->extraAttributes(['class' => 'font-black'])->money('gbp'))
->money(),
ruddy
ruddy6mo ago
No description
ChesterS
ChesterS6mo ago
Ok this took some digging but you can change this on the table using ->pluralModelLabel() eg
public static function table(Table $table): Table
{
return $table
->pluralModelLabel('Things');
}
public static function table(Table $table): Table
{
return $table
->pluralModelLabel('Things');
}
it will still say 'All Things' though. This is using tranlsations Not sure how you would override it - check vendor/filament/tables/resources/lang/en/table.php
'subheadings' => [
'all' => 'All :label',
'group' => ':group summary',
'page' => 'This page',
],
'subheadings' => [
'all' => 'All :label',
'group' => ':group summary',
'page' => 'This page',
],
ruddy
ruddy6mo ago
Thanks, it works