32 lines
668 B
PHP
32 lines
668 B
PHP
<?php
|
|
|
|
namespace App\Models\Shop;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class ArticleAttributeValue extends Model
|
|
{
|
|
protected $guarded = ['id'];
|
|
protected $table = 'shop_article_attribute_values';
|
|
|
|
public function article_attribute_family()
|
|
{
|
|
return $this->belongsTo('App\Models\Shop\ArticleAttributeFamily');
|
|
}
|
|
|
|
public function attributes()
|
|
{
|
|
return $this->hasMany('App\Models\Shop\ArticleAttribute');
|
|
}
|
|
|
|
public function articles()
|
|
{
|
|
return $this->hasMany('App\Models\Shop\ArticleAttribute')->groupBy('article_id');
|
|
}
|
|
|
|
public function scopeByFamily($query, $id)
|
|
{
|
|
return $query->where('article_attribute_family_id', $id);
|
|
}
|
|
|
|
} |