-
Notifications
You must be signed in to change notification settings - Fork 34
Closed
Description
- Laravel Version: 8.83.9
- Nova Version: 4.2.5
- PHP Version: 8.1.3
Description:
In my user resource, there is a HasOne relationship to accesses. The accesses are using the soft-deleted trait. In Nova, the attached soft-deleted access is shown in the user detail page. In our case, this is not expected behavior and this behavior deviates from the HasOne relationship behavior of laravel/eloquent. Because in that case, soft-deleted models are not concerned. In addition, there is no method available like for the BelongsTo field to filter out trashed models.

Detailed steps to reproduce the issue on a fresh Nova installation:
Models/User.php
public function access(): HasOne
{
return $this->hasOne(Access::class);
}Nova/User.php
public function fields(NovaRequest $request): array
{
// More fields here
HasOne::make('Access')->exceptOnForms(),
}Models/Access.php
public function user(): BelongsTo
{
return $this->belongsTo(User::class)->withTrashed();
}Nova/Access.php
public function fields(NovaRequest $request): array
{
// More fields here
BelongsTo::make('User')
->exceptOnForms(),
}Metadata
Metadata
Assignees
Labels
No labels