mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-24 13:14:07 -08:00
Check for array
Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
parent
76301bc30d
commit
4e4930ba62
|
@ -1811,7 +1811,9 @@ class Asset extends Depreciable
|
||||||
public function scopeInCategory($query, $category_id)
|
public function scopeInCategory($query, $category_id)
|
||||||
{
|
{
|
||||||
return $query->join('models as category_models', 'assets.model_id', '=', 'category_models.id')
|
return $query->join('models as category_models', 'assets.model_id', '=', 'category_models.id')
|
||||||
->join('categories', 'category_models.category_id', '=', 'categories.id')->whereIn('category_models.category_id', $category_id);
|
->join('categories', 'category_models.category_id', '=', 'categories.id')
|
||||||
|
->whereIn('category_models.category_id', (!is_array($category_id) ? explode(',',$category_id): $category_id));
|
||||||
|
//->whereIn('category_models.category_id', $category_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1825,7 +1827,7 @@ class Asset extends Depreciable
|
||||||
public function scopeByManufacturer($query, $manufacturer_id)
|
public function scopeByManufacturer($query, $manufacturer_id)
|
||||||
{
|
{
|
||||||
return $query->join('models', 'assets.model_id', '=', 'models.id')
|
return $query->join('models', 'assets.model_id', '=', 'models.id')
|
||||||
->join('manufacturers', 'models.manufacturer_id', '=', 'manufacturers.id')->whereIn('models.manufacturer_id', $manufacturer_id);
|
->join('manufacturers', 'models.manufacturer_id', '=', 'manufacturers.id')->whereIn('models.manufacturer_id', (!is_array($manufacturer_id) ? explode(',',$manufacturer_id): $manufacturer_id));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue