Liveblog - start work

This commit is contained in:
NH Gooi
2026-02-08 20:43:55 +01:00
parent 733e18531f
commit b78379f268
7 changed files with 375 additions and 353 deletions

View File

@@ -9,22 +9,25 @@ class HomeController extends Controller
{
public function show(Request $request)
{
$page = (int)$request->get('pagina', 1);
$apiResult = $this->API('nieuws/overzicht?pagina=' . (int)max(1, $page) . '&aantal=10');
$page = (int) $request->get('pagina', 1);
$apiResult = $this->API('nieuws/overzicht?pagina=' . (int) max(1, $page) . '&aantal=10');
$news = [];
foreach ($apiResult->news as $newsItem) {
$news[] = new \Model\NewsItem($newsItem);
}
}
$apiResult = $this->API('nieuws/liveblogs');
$liveblogs = $apiResult->liveblogs;
$populair = [];
$apiResult = $this->API('nieuws/populair?pagina=' . (int)max(1, $page) . '&aantal=5');
$apiResult = $this->API('nieuws/populair?pagina=' . (int) max(1, $page) . '&aantal=5');
foreach ($apiResult->news as $newsItem) {
$populair[] = new \Model\NewsItem($newsItem);
}
$apiResult = $this->API('podcast/overzicht?aantal=15');
$index = array_rand($apiResult->podcasts);
$apiResult = $this->API('podcast/overzicht?aantal=15');
$index = array_rand($apiResult->podcasts);
$podcast = new \Model\Podcast($apiResult->podcasts[$index]);
return view('home', ['populair' => $populair, 'podcast' => $podcast, 'title' => 'Home', 'news' => $news, 'searchURL' => 'nieuws/zoeken']);
return view('home', ['populair' => $populair, 'podcast' => $podcast, 'title' => 'Home', 'news' => $news, 'liveblogs' => $liveblogs, 'searchURL' => 'nieuws/zoeken']);
}
}