Nog meer mergefouten eruit gehaald

This commit is contained in:
2020-05-09 22:46:00 +02:00
parent fa07329e15
commit 35e627209f

View File

@@ -5,6 +5,8 @@ use Illuminate\Http\Request;
class NewsController extends Controller
{
private $EXTERNAL_NEWS_API;
private static $NEWS_CATEGORY = 1;
private static $CALENDAR_CATEGORY = 42;
private static $EXTERNAL_NEWS_CATEGORY = 44;
@@ -35,6 +37,7 @@ QUERY;
*/
public function __construct()
{
$this->EXTERNAL_NEWS_API = env('EXTERNAL_NEWS_API', '//');
}
/**
@@ -273,6 +276,14 @@ QUERY
$data = array('version' => 1,
'news' => new \Model\NewsItem($item['data'], $item['images'], $item['podcast']));
if($externalId = (int)$item['data']->external_id) {
$externalSource = json_decode(file_get_contents($this->EXTERNAL_NEWS_API . 'news?source=api&externalid=' . (int)$externalId));
if($externalSource) {
$data['version'] = 2;
$data['source'] = $externalSource->news;
}
}
return response()->json($data);
}