43 lines
1.1 KiB
PHP
43 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Api;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use App\Models\DisplayVideo;
|
|
use App\Models\DisplayFooterContent;
|
|
use Illuminate\Http\JsonResponse;
|
|
|
|
class DisplayConfigController extends Controller
|
|
{
|
|
/**
|
|
* Gibt die Konfiguration für die Display-Seite zurück
|
|
*/
|
|
public function index(): JsonResponse
|
|
{
|
|
$videos = DisplayVideo::active()->get()->map(function ($video) {
|
|
return [
|
|
'src' => $video->full_path,
|
|
'position' => $video->position,
|
|
];
|
|
});
|
|
|
|
$footerContent = DisplayFooterContent::active()->get()->map(function ($footer) {
|
|
$data = [
|
|
'headline' => $footer->headline,
|
|
'subline' => $footer->subline,
|
|
];
|
|
|
|
// URL nur hinzufügen wenn vorhanden
|
|
if ($footer->url) {
|
|
$data['url'] = $footer->short_url;
|
|
}
|
|
|
|
return $data;
|
|
});
|
|
|
|
return response()->json([
|
|
'videoPlaylist' => $videos,
|
|
'footerContent' => $footerContent,
|
|
]);
|
|
}
|
|
}
|