Added radio page

This commit is contained in:
Jorit Tijsen
2024-03-13 17:44:35 +01:00
parent d445d90069
commit a0baa0230f
40 changed files with 749 additions and 610 deletions

View File

@@ -131,8 +131,25 @@ class Controller extends BaseController
public function __call($method, $arguments) {
if(substr($method, 0, 5) == 'view_') {
$view = substr($method, 5);
if(view()->exists($view)) { return view($view); }
if(view()->exists($view)) { return view($view, $this->getSidebareData()); }
}
return abort(404);
}
public function getSidebareData()
{
$populair = [];
$apiResult = $this->API('nieuws/populair?aantal=5');
foreach ($apiResult as $_newsItem) {
$populair[] = new \Model\NewsItem($_newsItem);
}
$newsItems = [];
$apiResult = $this->API('nieuws/overzicht?aantal=5');
foreach ($apiResult->news as $_newsItem) {
$newsItems[] = new \Model\NewsItem($_newsItem);
}
return ['newsItems' => $newsItems, 'populair' => $populair];
}
}