belongsTo('App\Models\Shop\Article'); } public function attribute_value() { return $this->belongsTo('App\Models\Shop\ArticleAttributeValue', 'article_attribute_value_id'); } public function prices() { return $this->hasMany('App\Models\Shop\ArticlePrice'); } public function scopeByArticle($query, $id) { return $query->where('article_id', $id); } public function scopeByAttributeValue($query, $id) { return $query->where('attribute_value_id', $id); } }