Refactor article getter for descriptions & tags, minor fixes on tags

This commit is contained in:
Ludovic CANDELLIER
2022-06-22 22:28:18 +02:00
parent 35310b049e
commit 1703082b3e
12 changed files with 148 additions and 37 deletions

View File

@@ -24,8 +24,18 @@ class Merchandise extends Model implements HasMedia
return $this->morphMany(Article::class, 'product');
}
public function Producer()
{
return $this->belongsTo(Producer::class);
}
public function tags()
{
return $this->morphToMany(Tag::class, 'taggable');
}
public function scopeByProducer($query, $producer_id)
{
return $query->where('producer_id', $producer_id);
}
}