Files
isaaccladandCursor 9e2d79936c
Deploy Ladill Frontdesk / deploy (push) Failing after 35s
Test / test (push) Failing after 2m45s
Initial Ladill Frontdesk release with deploy pipeline.
Visitor management app with SSO, kiosk, badges, reports, and Gitea CI deploy to frontdesk.ladill.com.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-27 20:37:15 +00:00

32 lines
948 B
PHP

<?php
namespace App\Services\Frontdesk;
use App\Models\Visitor;
use Illuminate\Database\Eloquent\Collection;
class VisitorSearchService
{
/** @return Collection<int, Visitor> */
public function search(string $ownerRef, int $organizationId, string $query, int $limit = 20): Collection
{
$query = trim($query);
if ($query === '') {
return new Collection;
}
return Visitor::owned($ownerRef)
->where('organization_id', $organizationId)
->where(function ($q) use ($query) {
$q->where('full_name', 'like', "%{$query}%")
->orWhere('company', 'like', "%{$query}%")
->orWhere('phone', 'like', "%{$query}%")
->orWhere('email', 'like', "%{$query}%");
})
->orderByDesc('is_frequent')
->orderBy('full_name')
->limit($limit)
->get();
}
}