New version
This commit is contained in:
19
public/page/api/printers.php
Normal file
19
public/page/api/printers.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
header('Content-Type: application/json; charset=utf-8');
|
||||
|
||||
$app = app();
|
||||
$pdo = $app->pdo();
|
||||
|
||||
if (!$pdo) {
|
||||
http_response_code(500);
|
||||
echo json_encode(['error' => 'DB disabled or unavailable'], JSON_UNESCAPED_UNICODE);
|
||||
exit;
|
||||
}
|
||||
|
||||
$repo = new \App\Repository\MaterialMatrixRepository($pdo);
|
||||
$printers = $repo->listActivePrinters();
|
||||
|
||||
echo json_encode($printers, JSON_UNESCAPED_UNICODE);
|
||||
exit;
|
||||
Reference in New Issue
Block a user