F
Filamentβ€’4mo 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β€’4mo ago
Does this work for you? protected static ?string $modelLabel = 'whatever';
kennyhorna
kennyhornaOPβ€’4mo 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β€’4mo ago
you want to overrdide other UI elements?
kennyhorna
kennyhornaOPβ€’4mo ago
No, just the create button label text
TheRealTeeHill
TheRealTeeHillβ€’4mo ago
ahh you want to change the word "create" ?
kennyhorna
kennyhornaOPβ€’4mo ago
yes
TheRealTeeHill
TheRealTeeHillβ€’4mo ago
ok
TheRealTeeHill
TheRealTeeHillβ€’4mo ago
@kennyhorna Go to the ListMovimientos.php and add ->label('Register Movimiento') to the make function
TheRealTeeHill
TheRealTeeHillβ€’4mo ago
No description
kennyhorna
kennyhornaOPβ€’4mo ago
@TheRealTeeHill that's what I did but it doesn't work (see the snippet in the question)
TheRealTeeHill
TheRealTeeHillβ€’4mo ago
your code is getActions() when you need getHeaderActions()
kennyhorna
kennyhornaOPβ€’4mo ago
Ah my bad
TheRealTeeHill
TheRealTeeHillβ€’4mo ago
easy mistake to make πŸ™‚
kennyhorna
kennyhornaOPβ€’4mo 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β€’4mo 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