Fix some enhancements & new features

This commit is contained in:
Ludovic CANDELLIER
2020-07-26 16:51:45 +02:00
parent fcd26d13de
commit 1179b5ca31
54 changed files with 975 additions and 341 deletions

View File

@@ -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);
}
}