pimousse7928
Nested Fieldset and relationship
Hello there,
I have two nested fieldsets with relationship. At first save, address is not saving, however, at second save (update), address is saving correctly.
I guess it's easy to understand the the first model (company) is not created so it doesn't know to which model the address should be attached.
Did someone already did this?
->schema([
Forms\Components\Fieldset::make('Entreprise')
->relationship('company')
->schema([
Forms\Components\TextInput::make('name')->label('Nom'),
Forms\Components\TextInput::make('identification_number')->label('Numéro SIRET'),
Forms\Components\TextInput::make('sector_reference')->label('Code NAF'),
Forms\Components\TextInput::make('reference')->label('Numéro partenaire'),
Forms\Components\TextInput::make('vat')->label('Numéro de TVA'),
Forms\Components\Fieldset::make('Adresse')
->relationship('address')
->schema([
Forms\Components\TextInput::make('address_line_1')->label('Adresse ligne 1'),
Forms\Components\TextInput::make('address_line_2')->label('Adresse ligne 2'),
Forms\Components\TextInput::make('city')->label('Ville'),
Forms\Components\TextInput::make('postcode')->label('Code postal'),
Forms\Components\TextInput::make('country')->label('Pays'),
]),
])
]);
2 replies