Deploy Ladill Queue / deploy (push) Successful in 56s
Phases 1–6: tickets, counters, displays, appointments, workflows, rules, analytics, reports, feedback, admin, device API, and Gitea deploy workflow for queue.ladill.com. Co-authored-by: Cursor <cursoragent@cursor.com>
48 lines
1.3 KiB
PHP
48 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Qms;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use App\Services\Qms\DisplayService;
|
|
use App\Services\Qms\VoiceAnnouncementService;
|
|
use Illuminate\Http\JsonResponse;
|
|
use Illuminate\View\View;
|
|
|
|
class DisplayPublicController extends Controller
|
|
{
|
|
public function __construct(
|
|
protected DisplayService $displays,
|
|
protected VoiceAnnouncementService $voice,
|
|
) {}
|
|
|
|
public function show(string $token): View
|
|
{
|
|
$screen = $this->displays->findByToken($token) ?? abort(404);
|
|
$this->displays->touch($screen);
|
|
|
|
return view('qms.display.public', [
|
|
'screen' => $screen,
|
|
'dataUrl' => route('qms.display.data', $token),
|
|
]);
|
|
}
|
|
|
|
public function data(string $token): JsonResponse
|
|
{
|
|
$screen = $this->displays->findByToken($token) ?? abort(404);
|
|
$this->displays->touch($screen);
|
|
|
|
$payload = $this->displays->payload($screen);
|
|
|
|
foreach ($payload['announcements'] as $announcement) {
|
|
if (isset($announcement['id'])) {
|
|
$model = \App\Models\VoiceAnnouncement::find($announcement['id']);
|
|
if ($model) {
|
|
$this->voice->markPlayed($model);
|
|
}
|
|
}
|
|
}
|
|
|
|
return response()->json($payload);
|
|
}
|
|
}
|