add shipping rules

This commit is contained in:
Ludovic CANDELLIER
2023-07-16 14:45:42 +02:00
parent 72a7b270f9
commit 0879b0abf0
459 changed files with 6219 additions and 5416 deletions

View File

@@ -25,17 +25,18 @@ class Categorizable extends Model
public function scopeByCategory($query, $category_id)
{
return $query->where($this->table . '.category_id', $category_id);
return $query->where($this->table.'.category_id', $category_id);
}
public function scopeByCategories($query, $categories_id)
{
return $query->whereIn($this->table . '.category_id', $categories_id);
return $query->whereIn($this->table.'.category_id', $categories_id);
}
public function scopeByCategoryParent($query, $category_id)
{
$category = Category::find($category_id);
return $query->whereHas('category', function ($query) use ($category) {
return $query->inRange($category->_lft, $category->_rgt);
});