F
Filamentβ€’5mo ago
kennyhorna

Customize "create :resource" button label

Morning, I'd like to change the "create :resource" label to "register :resource" on my list page. I've been checking the docs but I can't find the right place to do it. I have tried to add this in the ListMovements.php page (my resource is called MovementResource) but I haven't been lucky:
protected function getActions(): array
{
return [
Actions\CreateAction::make()->label('Registrar movimiento'),
];
}
protected function getActions(): array
{
return [
Actions\CreateAction::make()->label('Registrar movimiento'),
];
}
Thanks in advance.
No description
16 Replies
TheRealTeeHill
TheRealTeeHillβ€’5mo ago
Does this work for you? protected static ?string $modelLabel = 'whatever';
kennyhorna
kennyhornaOPβ€’5mo ago
Yes, but that customs only the resource name (displayed in the sidebar). So the button is now "Create whatever" What I'd like to do is rename the whole button label to "Register whatever" instead
TheRealTeeHill
TheRealTeeHillβ€’5mo ago
you want to overrdide other UI elements?
kennyhorna
kennyhornaOPβ€’5mo ago
No, just the create button label text
TheRealTeeHill
TheRealTeeHillβ€’5mo ago
ahh you want to change the word "create" ?
kennyhorna
kennyhornaOPβ€’5mo ago
yes
TheRealTeeHill
TheRealTeeHillβ€’5mo ago
ok
TheRealTeeHill
TheRealTeeHillβ€’5mo ago
@kennyhorna Go to the ListMovimientos.php and add ->label('Register Movimiento') to the make function
TheRealTeeHill
TheRealTeeHillβ€’5mo ago
No description
kennyhorna
kennyhornaOPβ€’5mo ago
@TheRealTeeHill that's what I did but it doesn't work (see the snippet in the question)
TheRealTeeHill
TheRealTeeHillβ€’5mo ago
your code is getActions() when you need getHeaderActions()
kennyhorna
kennyhornaOPβ€’5mo ago
Ah my bad
TheRealTeeHill
TheRealTeeHillβ€’5mo ago
easy mistake to make πŸ™‚
kennyhorna
kennyhornaOPβ€’5mo ago
So, it didn't work before cause the method was already defined (I generated the resource with Laravel idea. Anyway, thank you @TheRealTeeHill πŸ˜ƒ Have a nice day
TheRealTeeHill
TheRealTeeHillβ€’5mo ago
no worries, got the result in the end, all the best, please mark my answer as solved ❀️
Want results from more Discord servers?
Add your server