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