Deploy Ladill Frontdesk / deploy (push) Successful in 59s
Ship OEM documentation for MDM, Elo, and Zebra lockdown plus a provisioning QR on kiosk device registration so factory tablets can pair on first boot. Co-authored-by: Cursor <cursoragent@cursor.com>
57 lines
1.4 KiB
PHP
57 lines
1.4 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);
|
|
}
|
|
|
|
public function kioskUrl(string $deviceToken): string
|
|
{
|
|
return route('frontdesk.kiosk.device', $deviceToken);
|
|
}
|
|
|
|
public function kioskSvg(string $deviceToken, int $size = 200): string
|
|
{
|
|
return $this->renderSvg($this->kioskUrl($deviceToken), $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);
|
|
}
|
|
}
|