Arrive search: Ignore datetime

This commit is contained in:
Igor Scheller 2023-08-26 00:40:43 +02:00 committed by Michael Weimann
parent 2252819800
commit f966b1521f
1 changed files with 7 additions and 1 deletions

View File

@ -78,7 +78,13 @@ function admin_arrive()
foreach ($users as $usr) { foreach ($users as $usr) {
if (count($tokens) > 0) { if (count($tokens) > 0) {
$match = false; $match = false;
$index = join(' ', $usr->attributesToArray()); $data = collect($usr->toArray())->flatten()->filter(function ($value) {
// Remove empty values
return !empty($value) &&
// Skip datetime
!preg_match('/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{6}Z$/', (string) $value);
});
$index = join(' ', $data->toArray());
foreach ($tokens as $token) { foreach ($tokens as $token) {
$token = trim($token); $token = trim($token);
if (!empty($token) && stristr($index, $token)) { if (!empty($token) && stristr($index, $token)) {