Skip to content
Discussion options

You must be logged in to vote

In our case, this is not expected behavior and this behavior deviates from the HasOne relationship behavior of laravel/eloquent.

Detail query is executed without global scope in order for Nova to still access soft deleted Access model.

Now, it seem that the relationship should have been User has one of many Access, where you can define it via:

// Models/User.php
public function profile()
{
    return $this->hasOne(Access::class)->ofMany()->latest()->withoutTrashed();
}
// Nova/User.php
public function fields(NovaRequest $request)
{
    return [
        HasOne::ofMany('Profile'),
    ];
}

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@Hannoma
Comment options

@wajdijurry
Comment options

Answer selected by Hannoma
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants
Converted from issue

This discussion was converted from issue #4118 on April 26, 2022 13:23.