Textinput not populating relationship data in EditRecord Form
Hi all,
As per the attached image, my TextColumn on the list page is showing related data correctly.
However when using a TextInput on the EditRecord to show data from the related record it is not showing.
public static function table(Table $table): Table
{
....
Tables\Columns\TextColumn::make('user.name') // Returns the correct data
....
}
public static function form(Form $form): Form
{
....
Forms\Components\TextInput::make('user.name'), // Returns no data
....
}
I wonder if there's some 'relationship' field or something I need to set on the TextInput?
FYI, I have tried using a 'FieldSet' with the relationship set to User and putting the TextInput in there. That works, however when saving the form I don't get the data submitted. Perhaps there is a property I can set on the Fieldset that will allow the data to be posted?
Thank you!
PS: ( I have created a workaround by modifying the 'getEloquentQuery()' function on the ClubMemberResource page. I have joined the users table and selected the user.name column as 'users.user_name'. This allows me to create Forms\Components\TextInput::make('user_name') and it populates. However this feels like a hack and I'd like to know where I'm going wrong if possible.)
As per the attached image, my TextColumn on the list page is showing related data correctly.
However when using a TextInput on the EditRecord to show data from the related record it is not showing.
public static function table(Table $table): Table
{
....
Tables\Columns\TextColumn::make('user.name') // Returns the correct data
....
}
public static function form(Form $form): Form
{
....
Forms\Components\TextInput::make('user.name'), // Returns no data
....
}
I wonder if there's some 'relationship' field or something I need to set on the TextInput?
FYI, I have tried using a 'FieldSet' with the relationship set to User and putting the TextInput in there. That works, however when saving the form I don't get the data submitted. Perhaps there is a property I can set on the Fieldset that will allow the data to be posted?
Thank you!
PS: ( I have created a workaround by modifying the 'getEloquentQuery()' function on the ClubMemberResource page. I have joined the users table and selected the user.name column as 'users.user_name'. This allows me to create Forms\Components\TextInput::make('user_name') and it populates. However this feels like a hack and I'd like to know where I'm going wrong if possible.)
