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>
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
<?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();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user