© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
3 replies
urbycoz

Why doesn't my placeholder work on columns with relationships?

I've set up a relationship between Customer and Account models.

class Customer extends Model
{
public function account(): HasOne
{
return $this->hasOne(Account::class, 'contactid');
}
}

class Account extends Model
{
public function individual(): BelongsTo
{
return $this->belongsTo(Individual::class, 'contactid');
}
}

So when I create an infolist with the section below the correct field values are loaded. The problem is that when the values are null the placeholder does not show for account.name.

Section::make('Customer Details')
->schema([
TextEntry::make('account.name')
->label('Account ID')
->placeholder('empty'), //This never shows
TextEntry::make('fullname')
->label('Account Type'), //This shows ok
)]

This behaviour seems to happen for all TextEntry fields that use relationships for their values.

I've even checked dd($this->customer->account) and I can see that the name is null.
Solution
I've found a way round this. Add this to the TextEntry:

->getStateUsing(fn ($record) => $record->account->name ?? null)
Jump to solution
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

In infolist placeholder doesn't work?
FilamentFFilament / ❓┊help
3y ago
Placeholder on relational table columns
FilamentFFilament / ❓┊help
3y ago
Why mutateFormDataBeforeCreate() doesn't work
FilamentFFilament / ❓┊help
3y ago
Why actions on the production server doesn't work?
FilamentFFilament / ❓┊help
3y ago