Editing resource that has a HasOne self reference results in error #5435
-
Description:Hi, I have a model called class Deadline extends Model
{
use HasFactory;
protected $fillable = [
'exceeds_at',
'postponed_id',
];
protected $casts = [
'exceeds_at' => 'datetime',
];
public function postponed(): BelongsTo
{
return $this->belongsTo(Deadline::class);
}
public function postpones(): HasOne
{
return $this->hasOne(Deadline::class, 'postponed_id');
}
}The nova resource for this model looks like this: class Deadline extends Resource
{
public static $model = \App\Models\Deadline::class;
public function fields(NovaRequest $request)
{
return [
ID::make()->sortable(),
Date::make('exceeds_at'),
BelongsTo::make('Postponed To', 'postponed', Deadline::class)
->readonly(),
HasOne::make('Postponed From', 'postpones', Deadline::class)
->readonly(),
];
}
}I can view the resources without any problems: But when I click on the edit button, I get endless loading: The nova-api request returns HTTP 500 after either running out of memory or hitting the maximum execution time. The Update.vue then runs into the following error: Detailed steps to reproduce the issue on a fresh Nova installation:
Thanks for your help |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
|
It might be best not to include inline HasOne::make('Postponed From', 'postpones', Deadline::class)->exceptOnForms(), |
Beta Was this translation helpful? Give feedback.
-
|
Thanks for your answer. What is the desired behaviour for this case? HasOne relations that are no self-reference do not require me to add |
Beta Was this translation helpful? Give feedback.


It might be best not to include inline
HasOneon create/edit for this structure. e.g: