You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you have a HasOneThrough relationship between 2 models and display one of them in Nova as a resource all relationships of both resources are displayed at the same time as sections.
Detailed steps to reproduce the issue on a fresh Nova installation:
class Category extends Model
{
/** * Get the building that owns the category. */publicfunctionbuilding()
{
return$this->belongsTo(Building::class);
}
/** * Get the listing associated with the category. */publicfunctionlisting()
{
return$this->hasOne(Listing::class);
}
}
class Listing extends Model
{
/** * Get the category for the listing. */publicfunctioncategory()
{
return$this->belongsTo(Category::class);
}
/** * Get the building that owns the listing. */publicfunctionbuilding()
{
return$this->hasOneThrough(Building::class, Category::class, 'id', 'id', 'category_id', 'building_id');
}
}
class Building extends Model
{
/** * Get the categories for the building. */publicfunctioncategories()
{
return$this->hasMany(Category::class);
}
/** * Get the listings for the building. */publicfunctionlistings()
{
return$this->hasManyThrough(Listing::class, Category::class);
}
}
I created very basic Nova resources for them that you can check in the reproduction repo:
And here is what I see in any Category page in Nova:
If you activate Action logs you would see multiple Action sections at the same time.
The text was updated successfully, but these errors were encountered:
chimit
changed the title
Unwanted indirect relationships are displayed when using HasOneThrough
Unwanted indirect relationships are displayed when using HasOne relationship
Jan 17, 2023
Description:
If you have a HasOneThrough relationship between 2 models and display one of them in Nova as a resource all relationships of both resources are displayed at the same time as sections.
Detailed steps to reproduce the issue on a fresh Nova installation:
I created very basic Nova resources for them that you can check in the reproduction repo:
And here is what I see in any Category page in Nova:
If you activate Action logs you would see multiple Action sections at the same time.
The text was updated successfully, but these errors were encountered: