Display Model name on page title
So, i have tried for an hour or two now, figured i have to ask because i can find some info on getTitle() and getHeader and getHeading(), however, even if i do return $this->record->name
It does not return it, if i dont have a null check i get error that name is null.
I figured its because its not loaded yet, but i have tried everything now, whats the cleanest and bests way to just display the model name ( model of which we are editing right now ) as title of page?
I did self::$title but that changed title on a lot of pages not just the particual one i am on.
Solution:Jump to solution
It's because you made the
$record protected. I think Livewire only fills public properties.6 Replies
I'd say it should work. Can you share your code?
I just tested this with the v4 demo:

Ahh well i am not extending EditRecord, my page is custom.
Im not at work atm but looks something like
class MyJob extends Page implements HasForms
{
use InteractsWithForms;
protected string $view = 'filament.app.pages.jobs.my-job';
protected static ?string $slug = 'my-job/{record}';
protected ?Assignment $record = null;
public int|string|null $recordId = null;
public ?array $data = [];
public string $activeTab = 'settings';
Then i have a mount method to load record relationships $this->record = $record->load('timesheets', 'client');
And then the getTitle method.
Should also note that the page is working nicely, saving etc, just the name in title missing atm.Solution
It's because you made the
$record protected. I think Livewire only fills public properties.wow
sorry man
i was tired after a long day
missed that xD it was the issue. Thank you for the quick responses.
Had to test it myself, too. Not easy to spot 😅