Fixes on available offers in category childrens for building menu

This commit is contained in:
Ludovic CANDELLIER
2022-04-25 22:36:43 +02:00
parent c9bf18d87d
commit 61a52ef330
3 changed files with 5 additions and 8 deletions

View File

@@ -18,9 +18,9 @@ class Categorizable extends Model
return $this->belongsTo(Category::class);
}
public function articles()
public function article()
{
return $this->belongsTo(Article::class)->where('categorizable_type', Article::class);
return $this->belongsTo(Article::class, 'categorizable_id');
}
public function scopeByCategory($query, $category_id)