Add filters
This commit is contained in:
@@ -38,13 +38,27 @@ class Offer extends Model
|
||||
return $query->where('article_id', $id);
|
||||
}
|
||||
|
||||
public function scopeByArticleNature($query, $article_nature_id)
|
||||
{
|
||||
return $query->whereHas('article.article_nature', function ($query) use ($article_nature_id) {
|
||||
$query->byArticleNature($article_nature_id);
|
||||
});
|
||||
}
|
||||
|
||||
public function scopeByCategory($query, $category_id)
|
||||
{
|
||||
return $query->whereHas('article.categories', function ($query) use ($category_id) {
|
||||
$query->where('category_id', $category_id);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public function scopeByPackage($query, $package_id)
|
||||
{
|
||||
return $query->whereHas('variation', function ($query) use ($package_id) {
|
||||
$query->byPackage($package_id);
|
||||
});
|
||||
}
|
||||
|
||||
public function scopeByStatus($query, $id)
|
||||
{
|
||||
return $query->where('status_id', $id);
|
||||
|
||||
Reference in New Issue
Block a user