Files
ladill-frontdesk/app/Services/Frontdesk/QrCodeService.php
T
isaaccladandCursor 890c2c71e3
Deploy Ladill Frontdesk / deploy (push) Failing after 26s
Add employee presence with kiosk sign-in, QR badges, and mobile step-out.
Enables staff roster, PIN/code kiosk flow, attendance reports, evacuation staff roll call, webhooks, branch mismatch warnings, and a linked-user My presence portal.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-28 21:11:18 +00:00

47 lines
1.1 KiB
PHP

<?php
namespace App\Services\Frontdesk;
use App\Models\Employee;
use App\Models\Visit;
use chillerlan\QRCode\QRCode;
use chillerlan\QRCode\QROptions;
class QrCodeService
{
public function visitUrl(Visit $visit): string
{
$path = config('frontdesk.badge.qr_url_path', '/q');
return url($path.'/'.$visit->qr_token);
}
public function employeeUrl(Employee $employee): string
{
$path = config('frontdesk.badge.employee_qr_url_path', '/eq');
return url($path.'/'.$employee->qr_token);
}
public function svg(Visit $visit, int $size = 200): string
{
return $this->renderSvg($this->visitUrl($visit), $size);
}
public function employeeSvg(Employee $employee, int $size = 200): string
{
return $this->renderSvg($this->employeeUrl($employee), $size);
}
protected function renderSvg(string $url, int $size = 200): string
{
$options = new QROptions([
'outputType' => QRCode::OUTPUT_MARKUP_SVG,
'scale' => 5,
'imageBase64' => false,
]);
return (new QRCode($options))->render($url);
}
}