Refactor article getter for descriptions & tags, minor fixes on tags
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,11 +3,17 @@
|
||||
namespace App\Models\Shop;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
use Dyrynda\Database\Support\CascadeSoftDeletes;
|
||||
|
||||
class TagGroup extends Model
|
||||
{
|
||||
use CascadeSoftDeletes, SoftDeletes;
|
||||
|
||||
protected $guarded = ['id'];
|
||||
protected $table = 'tag_groups';
|
||||
protected $cascadeDeletes = ['tags'];
|
||||
|
||||
public function tags()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user