Custom browser tab title

Maybe this is a simple question but, when i visualize a resource, in the browser tab i get the title i choosse with public function getTitle(): string { return __('customer.customers'); } followed by a - how can i customize this title to remove the - or add something after? (for example the title of the single resource when edit) Thanks
No description
7 Replies
toeknee
toeknee7mo ago
Add the Application name to the .env? It should be like: APP_NAME="MY App"
Soundmit
SoundmitOP7mo ago
i have the app_name ready but not appear in the tab and, i want to show the customer name while i view or edit his resource something like Customer - John Bohnam
toeknee
toeknee6mo ago
public function getTitle(): string
{
return __('customer.customers') . $this->record->name;
}
public function getTitle(): string
{
return __('customer.customers') . $this->record->name;
}
Matthew
Matthew6mo ago
Very useful, was wondering about this, and saved me some time looking. Works on ViewRecord, any idea how to replicate on EditRecord @toeknee ?? 🫶
toeknee
toeknee6mo ago
It should work on View and Edit but not Create
Matthew
Matthew6mo ago
ahh...actually, I'm accessing the edit in a slideover from the ViewRecord, rather than the Edit* page. protected function getHeaderActions() : array { return [ EditAction::make() ->slideOver() ->form(DetailsForm::getForm()), ]; } Suspect this makes the difference, and assume have to dive into the EditAction class to influence that ?
toeknee
toeknee6mo ago
Correct, if it's not a page you cannot change the page title really from a slideOver without some custom JS. You should link to a page to change the page title. Instead change the modal header title and do the same with ->modalHeading(fn($record) => __('customer.customers') . $record->name)
Want results from more Discord servers?
Add your server