morphedByMany(Article::class, 'categorizable'); } public function Shelves() { return $this->morphedByMany(Category::class, 'categorizable'); } public function CategoryTree() { return $this->belongsTo(app('rinvex.categories.category'),'category_id'); } public function scopeByCategory($query, $category_id) { return $query->where('category_id', $category_id); } }