Fix bug in news controller
This commit is contained in:
@@ -288,9 +288,11 @@ QUERY
|
||||
$result = array();
|
||||
foreach($recent as $item)
|
||||
{
|
||||
$newsItem = app('db')->select(self::$BASE_SQL . ' AND `news`.`id` = :newsId', ['target' => self::$WEBSITE_TARGET, 'category' => $category, 'secondarycategory' => $secondarycategory, 'newsId' => $item->id])[0];
|
||||
$pictures = app('db')->select(self::$LOAD_IMAGES, ['newsId' => $newsItem->id]);
|
||||
$result[] = new \Model\NewsItem($newsItem, $pictures);
|
||||
$newsItem = app('db')->select(self::$BASE_SQL . ' AND `news`.`id` = :newsId', ['target' => self::$WEBSITE_TARGET, 'category' => $category, 'secondarycategory' => $secondarycategory, 'newsId' => $item->id]);
|
||||
if(count($newsItem)) {
|
||||
$pictures = app('db')->select(self::$LOAD_IMAGES, ['newsId' => $newsItem[0]->id]);
|
||||
$result[] = new \Model\NewsItem($newsItem[0], $pictures);
|
||||
}
|
||||
}
|
||||
|
||||
return response()->json($result);
|
||||
|
||||
Reference in New Issue
Block a user