|
|
@@ -96,7 +96,12 @@ class UserService
|
|
|
$query->where(function ($q) use ($term, $cpfTerm) {
|
|
|
$q->whereRaw('UNACCENT(LOWER(name)) LIKE UNACCENT(?)', [$term])
|
|
|
->orWhereRaw('UNACCENT(LOWER(email)) LIKE UNACCENT(?)', [$term])
|
|
|
- ->orWhereRaw('UNACCENT(LOWER(COALESCE(registration, \'\'))) LIKE UNACCENT(?)', [$term]);
|
|
|
+ ->orWhereRaw('UNACCENT(LOWER(COALESCE(registration, \'\'))) LIKE UNACCENT(?)', [$term])
|
|
|
+ ->orWhereRaw("TO_CHAR(admission_date, 'DD/MM/YYYY') LIKE ?", [$term])
|
|
|
+ ->orWhereRaw("TO_CHAR(expiry_date, 'DD/MM/YYYY') LIKE ?", [$term])
|
|
|
+ ->orWhereHas('position', function ($p) use ($term) {
|
|
|
+ $p->whereRaw('UNACCENT(LOWER(positions.name)) LIKE UNACCENT(?)', [$term]);
|
|
|
+ });
|
|
|
|
|
|
if ($cpfTerm) {
|
|
|
$q->orWhere('cpf', 'LIKE', $cpfTerm);
|
|
|
@@ -104,6 +109,11 @@ class UserService
|
|
|
});
|
|
|
}
|
|
|
|
|
|
+ if (isset($filters['first_access']) && $filters['first_access'] !== '') {
|
|
|
+ $accessed = filter_var($filters['first_access'], FILTER_VALIDATE_BOOLEAN);
|
|
|
+ $accessed ? $query->whereHas('accessLogs') : $query->whereDoesntHave('accessLogs');
|
|
|
+ }
|
|
|
+
|
|
|
return $query;
|
|
|
}
|
|
|
|