Visitor management app with SSO, kiosk, badges, reports, and Gitea CI deploy to frontdesk.ladill.com. Co-authored-by: Cursor <cursoragent@cursor.com>
29 lines
638 B
PHP
29 lines
638 B
PHP
<?php
|
|
|
|
namespace App\Services\Frontdesk;
|
|
|
|
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 svg(Visit $visit, int $size = 200): string
|
|
{
|
|
$options = new QROptions([
|
|
'outputType' => QRCode::OUTPUT_MARKUP_SVG,
|
|
'scale' => 5,
|
|
'imageBase64' => false,
|
|
]);
|
|
|
|
return (new QRCode($options))->render($this->visitUrl($visit));
|
|
}
|
|
}
|