Can I display a relation in Forms like I can in Table?

In my CampaignResource I have a title In the form a working Select
Forms\Components\Select::make('title_id')
->relationship('title', 'name')
Forms\Components\Select::make('title_id')
->relationship('title', 'name')
In the table a working
Tables\Columns\TextColumn::make('title.name'),
Tables\Columns\TextColumn::make('title.name'),
But this doesn't work in the form... I want to display only. Not allow change at a certain point,
Forms\Components\TextInput::make('title.name')
->label('Title'),

Forms\Components\TextInput::make('title.name')
->label('Title'),

Do I need to use a select and make it read only? Model
public function title(): BelongsTo
{
return $this->belongsTo(Title::class);
}
public function title(): BelongsTo
{
return $this->belongsTo(Title::class);
}
Solution:
You can use a placeholder and provide the value yourself or use the Select and make it ->disabled()
Jump to solution
2 Replies
Solution
Dennis Koch
Dennis Koch6mo ago
You can use a placeholder and provide the value yourself or use the Select and make it ->disabled()
ddoddsr
ddoddsrOP6mo ago
Placeholder::make('person_name') ->content(fn (Campaign $record): string => $record->persona->name), So easy thanks
Want results from more Discord servers?
Add your server