Hi,
I'm having some problems with Laravel Nova 4.
I have a table with a nullable column to store an extension ID. This is optional which is why it is nullable.
The models method is like
public function extension(): BelongsTo
{
return $this->belongsTo(Model\Detail::class, 'extension_id', 'id');
}
and in the nova resource class it looks like this
Fields\BelongsTo::make('Extension Details', 'extension', Nova\Detail::class)->searchable()->required(false)
When I try to save the resource without selecting an extension it get an error to indicate that the field is required (the red "validation.required" text shows), even though the red star to indicate required fields is not visible.
Without the ->required(false) the red star shows and same validation error.
Is there any reason I cannot used a belongsTo field that is nullable?