refactor, better class namespace intergration
This commit is contained in:
@@ -14,21 +14,21 @@ class Price extends Model
|
||||
|
||||
public function article()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Shop\Article');
|
||||
return $this->belongsTo(Article::class);
|
||||
}
|
||||
|
||||
public function article_family()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Shop\ArticleNature');
|
||||
return $this->belongsTo(ArticleNature::class);
|
||||
}
|
||||
|
||||
public function scopeByArticle($query, $id)
|
||||
{
|
||||
return $query->where('article_id', $id);
|
||||
return $query->where($this->table . '.article_id', $id);
|
||||
}
|
||||
|
||||
public function scopeByArticleNature($query, $id)
|
||||
{
|
||||
return $query->where('article_family_id', $id);
|
||||
return $query->where($this->table . '.article_family_id', $id);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user