I'm using Laravel Nova. I have a resource of a Company that should have an address. The address is stored in a different global Address resource. How can I directly add the Address info when creating a Company?
That's why I have this Fields now:
public function fields(Request $request)
{
return [
ID::make()->sortable(),
Text::make('Company name', 'name')->sortable()->rules('required', 'max:255'),
Text::make('Website', 'website')->hideFromIndex()->rules('nullable', 'url'),
Markdown::make('Info')->alwaysShow(),
BelongsTo::make('User')->searchable()->rules('required'),
## Address Resource needs
Place::make('Streetname and number', 'address.address')->hideWhenUpdating(),
Text::make('City', 'address.city')->hideWhenUpdating(),
Text::make('Zipcode', 'address.postcode')->hideWhenUpdating(),
Text::make('Latitude', 'address.latitude')->hideWhenUpdating(),
Text::make('Longitude', 'address.longitude')->hideWhenUpdating(),
// BelongsTo::make('Address')->searchable()->rules('required')->hideWhenCreating(),
];
}
However, this doesn't work. I can't see any mention of storing nested relations in the documentation; is that possible?