Best way to overwrite the name of a resource. #3509
-
Hi, I've got a model named "vACC", while this may not be the typical naming convention, it's what I've gone with. I've created a resource for this model but it has set the label as "V A C C", is there any way to disable this autocapitalization and word splitting? I understand that some of this can be set using $label and $pluralLabel but this seems a little unreliable and does not update the header from what I can see. |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 8 replies
-
You can override it in the resource.
https://filamentphp.com/docs/2.x/admin/resources/getting-started#model-labels Edit: I just saw you mentioned $label already, I'm not sure how else you can do it. You could add a method on the base resource that dynamically sets the label. I would just stick to the default naming conventions though. |
Beta Was this translation helpful? Give feedback.
-
What about protected static ?string $navigationLabel = 'foo'; Edit: you can use protected static ?string $breadcrumb = 'foo'; |
Beta Was this translation helpful? Give feedback.
-
Ok using a mix of |
Beta Was this translation helpful? Give feedback.
-
hello, |
Beta Was this translation helpful? Give feedback.
-
just add the following at the top of your resource class to get rid of the extra "s" character:
|
Beta Was this translation helpful? Give feedback.
Ok using a mix of
$modeLabel
,$pluralModelLabel
,$breadcrumb
,$navigationLabel
, and manually setting the$title
of pages, I have managed to update everything to their intended values. I do think that there should be some kind of way to disable this autocapitalization for specific resources, however. Thank you @ousid and @hazj for all your help :)