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,42 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services\Printers;
|
||||
|
||||
use App\Contracts\Printers\PrinterDriverInterface;
|
||||
use App\Models\Visit;
|
||||
use InvalidArgumentException;
|
||||
|
||||
class PrinterManager
|
||||
{
|
||||
/** @var array<string, PrinterDriverInterface> */
|
||||
protected array $drivers = [];
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->register(new PdfPrinterDriver);
|
||||
$this->register(new ZebraPrinterDriver);
|
||||
$this->register(new BrotherPrinterDriver);
|
||||
$this->register(new DymoPrinterDriver);
|
||||
}
|
||||
|
||||
public function register(PrinterDriverInterface $driver): void
|
||||
{
|
||||
$this->drivers[$driver->name()] = $driver;
|
||||
}
|
||||
|
||||
public function driver(?string $name = null): PrinterDriverInterface
|
||||
{
|
||||
$name = $name ?? config('frontdesk.printers.default_driver', 'pdf');
|
||||
|
||||
if (! isset($this->drivers[$name])) {
|
||||
throw new InvalidArgumentException("Unknown printer driver: {$name}");
|
||||
}
|
||||
|
||||
return $this->drivers[$name];
|
||||
}
|
||||
|
||||
public function renderBadge(Visit $visit, ?string $driver = null): array
|
||||
{
|
||||
return $this->driver($driver)->renderBadge($visit);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user