Files
ladill-frontdesk/app/Services/Printers/ZebraPrinterDriver.php
T
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

36 lines
1009 B
PHP

<?php
namespace App\Services\Printers;
use App\Contracts\Printers\PrinterDriverInterface;
use App\Models\Visit;
class ZebraPrinterDriver implements PrinterDriverInterface
{
public function name(): string
{
return 'zebra';
}
public function renderBadge(Visit $visit): array
{
$visit->load(['visitor', 'host']);
$name = strtoupper(substr($visit->visitor->full_name, 0, 24));
$company = strtoupper(substr($visit->visitor->company ?? '', 0, 20));
$host = strtoupper(substr($visit->host?->name ?? '', 0, 20));
$code = $visit->badge_code;
$zpl = "^XA^FO50,50^A0N,40,40^FD{$name}^FS";
$zpl .= "^FO50,100^A0N,25,25^FD{$company}^FS";
$zpl .= "^FO50,140^A0N,25,25^FDHost: {$host}^FS";
$zpl .= "^FO50,180^BQN,2,5^FDQA,{$code}^FS";
$zpl .= "^XZ";
return [
'format' => 'zpl',
'content' => $zpl,
'filename' => 'badge-'.$visit->badge_code.'.zpl',
];
}
}