Display Module 13-05-2026
This commit is contained in:
parent
6a65354f4c
commit
9262132325
41 changed files with 496 additions and 334 deletions
|
|
@ -9,6 +9,35 @@ use Illuminate\Http\JsonResponse;
|
|||
|
||||
class DisplayVersionApiController extends Controller
|
||||
{
|
||||
public function overview(): JsonResponse
|
||||
{
|
||||
$displays = Display::query()
|
||||
->with(['livePlaylist.modules'])
|
||||
->where('is_active', true)
|
||||
->whereHas('livePlaylist.modules')
|
||||
->orderBy('name')
|
||||
->get()
|
||||
->map(function (Display $display): array {
|
||||
$playlist = $display->livePlaylist;
|
||||
|
||||
return [
|
||||
'id' => $display->id,
|
||||
'name' => $display->name,
|
||||
'location' => $display->location,
|
||||
'is_active' => $display->is_active,
|
||||
'is_live' => true,
|
||||
'module_count' => $playlist?->modules->count() ?? 0,
|
||||
'updated_at' => $playlist?->updated_at?->toIso8601String(),
|
||||
'url' => rtrim(config('display.player_url'), '/').'/?id='.$display->id,
|
||||
];
|
||||
})
|
||||
->values();
|
||||
|
||||
return response()->json([
|
||||
'displays' => $displays,
|
||||
]);
|
||||
}
|
||||
|
||||
public function config(Display $display, DisplayPlaylistConfigBuilder $configBuilder): JsonResponse
|
||||
{
|
||||
if (! $display->is_active) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue