adds user location scope, still needs fine tuning

This commit is contained in:
Godfrey M
2023-11-14 11:49:00 -08:00
parent 442cad69a7
commit 57019e170f
2 changed files with 22 additions and 2 deletions
+17
View File
@@ -787,5 +787,22 @@ class User extends SnipeModel implements AuthenticatableContract, AuthorizableCo
return $this;
}
public function scopeUserLocation($query, $location, $search){
return $query->where('location_id','=', $location)
->where('first_name', 'LIKE', '%' . $search . '%')
->orWhere('email', 'LIKE', '%' . $search . '%')
->orWhere('first_name', 'LIKE', '%' . $search . '%')
->orWhere('permissions', 'LIKE', '%' . $search . '%')
->orWhere('country', 'LIKE', '%' . $search . '%')
->orWhere('phone', 'LIKE', '%' . $search . '%')
->orWhere('jobtitle', 'LIKE', '%' . $search . '%')
->orWhere('employee_num', 'LIKE', '%' . $search . '%')
->orWhere('username', 'LIKE', '%' . $search . '%');
}
}