Nieuwe API aanpassingen
This commit is contained in:
@@ -22,14 +22,14 @@ class Controller extends BaseController
|
||||
$data = json_decode(Storage::disk('local')->get($file));
|
||||
foreach ($path as $subobject) {
|
||||
$data = $data->$subobject;
|
||||
}
|
||||
}
|
||||
$items = [];
|
||||
foreach ($data as $item_data) {
|
||||
$items[] = new $class($item_data);
|
||||
if ($maxItems && count($items) == $maxItems) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $items;
|
||||
}
|
||||
@@ -49,7 +49,7 @@ class Controller extends BaseController
|
||||
$view->with('data', $this->getDataFromFileAndConvert('laatste_nieuws.json', ['news'], '\Model\NewsItem'));
|
||||
});
|
||||
View::composer('widgets.populairnieuws', function ($view) {
|
||||
$view->with('data', $this->getDataFromFileAndConvert('populair_nieuws.json', [], '\Model\NewsItem'));
|
||||
$view->with('data', $this->getDataFromFileAndConvert('populair_nieuws.json', ['news'], '\Model\NewsItem'));
|
||||
});
|
||||
View::composer('widgets.nustraks', function ($view) {
|
||||
$data = json_decode(Storage::disk('local')->get('nu_straks.json'))->schedule;
|
||||
@@ -88,7 +88,7 @@ class Controller extends BaseController
|
||||
});
|
||||
View::composer('widgets.menu', function ($view) {
|
||||
$view->with('news', $this->getDataFromFileAndConvert('laatste_nieuws.json', ['news'], '\Model\NewsItem'))
|
||||
->with('popular', $this->getDataFromFileAndConvert('populair_nieuws.json', [], '\Model\NewsItem', 3))
|
||||
->with('popular', $this->getDataFromFileAndConvert('populair_nieuws.json', ['news'], '\Model\NewsItem', 3))
|
||||
->with('podcasts',
|
||||
$this->getDataFromFileAndConvert('laatste_podcasts.json', ['podcasts'], '\Model\Podcast'));
|
||||
});
|
||||
@@ -162,8 +162,8 @@ class Controller extends BaseController
|
||||
public function getSidebareData()
|
||||
{
|
||||
$populair = [];
|
||||
$apiResult = $this->API('nieuws/populair?aantal=5');
|
||||
foreach ($apiResult as $_newsItem) {
|
||||
$apiResult = $this->API('nieuws/populair?aantal=5');
|
||||
foreach ($apiResult->news as $_newsItem) {
|
||||
$populair[] = new \Model\NewsItem($_newsItem);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user