I have 2 models User
and Restaurant
.
Where the user has many restaurant relations concepts.
Models\User.php
public function restaurants(): HasMany
{
return $this->hasMany(Restaurant::class);
}
Models\Restaurant.php
// Columns
// 'user_id', 'name',
public function user(): BelongsTo
{
return $this->belongsTo(User::class);
}
Now, I have a form in the RestaurantResource
where I have used
Forms\Components\Fieldset::make('Owner Details')
->relationship('user')
->schema([
// Inputs
]),
Forms\Components\Fieldset::make('Restaurant Details')
->schema([
// Inputs
])
but I am getting this error.
I have also reviewed the official documentation https://filamentphp.com/docs/3.x/forms/advanced#saving-data-to-relationships but I feel I have followed the correct steps.