Use whereIn instead of where =

Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
snipe 2024-08-29 17:51:44 +01:00
parent 69e981364a
commit e62a802926

View file

@ -1561,7 +1561,7 @@ class Asset extends Depreciable
$leftJoin->on('assets_dept_users.id', '=', 'assets.assigned_to')
->where('assets.assigned_type', '=', User::class);
})->where(function ($query) use ($search) {
$query->where('assets_dept_users.department_id', '=', $search);
$query->whereIn('assets_dept_users.department_id', $search);
})->withTrashed()->whereNull('assets.deleted_at'); //workaround for laravel bug
}
@ -1811,7 +1811,7 @@ class Asset extends Depreciable
public function scopeInCategory($query, $category_id)
{
return $query->join('models as category_models', 'assets.model_id', '=', 'category_models.id')
->join('categories', 'category_models.category_id', '=', 'categories.id')->where('category_models.category_id', '=', $category_id);
->join('categories', 'category_models.category_id', '=', 'categories.id')->whereIn('category_models.category_id', $category_id);
}
/**
@ -1825,7 +1825,7 @@ class Asset extends Depreciable
public function scopeByManufacturer($query, $manufacturer_id)
{
return $query->join('models', 'assets.model_id', '=', 'models.id')
->join('manufacturers', 'models.manufacturer_id', '=', 'manufacturers.id')->where('models.manufacturer_id', '=', $manufacturer_id);
->join('manufacturers', 'models.manufacturer_id', '=', 'manufacturers.id')->whereIn('models.manufacturer_id', $manufacturer_id);
}