Fix some enhancements & new features
This commit is contained in:
@@ -9,23 +9,28 @@ class ArticleAttribute extends Model
|
||||
protected $guarded = ['id'];
|
||||
protected $table = 'shop_article_attributes';
|
||||
|
||||
public function Price()
|
||||
public function article()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Shop\Article');
|
||||
}
|
||||
|
||||
public function attribute_value()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Shop\ArticlePrice','article_price_id');
|
||||
return $this->belongsTo('App\Models\Shop\ArticleAttributeValue');
|
||||
}
|
||||
|
||||
public function Value()
|
||||
public function prices()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Shop\ArticleAttributeValue','attribute_value_id');
|
||||
return $this->hasMany('App\Models\Shop\ArticlePrice');
|
||||
}
|
||||
|
||||
public function scopeByPrice($query, $article_price_id)
|
||||
public function scopeByArticle($query, $id)
|
||||
{
|
||||
return $query->where('article_price_id', $article_price_id);
|
||||
return $query->where('article_id', $id);
|
||||
}
|
||||
|
||||
public function scopeByAttribueValue($query, $article_value_id)
|
||||
public function scopeByAttributeValue($query, $id)
|
||||
{
|
||||
return $query->where('article_value_id', $article_value_id);
|
||||
return $query->where('attribute_value_id', $id);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user