Moreira
Edit form not bringing data from the related table
Hello. Could anyone help me? When calling the edit form below, it is not bringing data from the related table. For example: The Model Client has an address_id, but when calling the form to update the client data, it does not return the address values in the inputs.
public static function form(Form $form): Form
{
return $form
->schema([
Forms\Components\Fieldset::make('Dados do cliente')
->schema([
Forms\Components\TextInput::make('name')
->label('Nome')
->columnSpan(2)
->required(),
Forms\Components\TextInput::make('email')
->label('E-mail')
->email(),
Forms\Components\TextInput::make('phone')
->label('Telefone')
->mask('(99) 99999-9999')
->tel(),
])
->columns(2),
Forms\Components\Fieldset::make('Endereço do cliente')
->schema([
Forms\Components\TextInput::make('address.postal_code')
->label('CEP')
->mask('99999-999')
->string()
->nullable(),
...
The code returns this:
18 replies