fix news post sorting

This commit is contained in:
Pachira 2017-03-22 20:51:50 +01:00
parent ca6309f3b4
commit 3413efd825
3 changed files with 3 additions and 1 deletions

View file

@ -64,6 +64,7 @@ class HomeController extends Controller
->whereNull('deleted_at')
->whereIn('category_id', explode(',', config('general.homepage-news')))
->limit(3)
->orderBy('created_at', 'desc')
->get();
$news = array_map(function (stdClass $row) {

View file

@ -38,6 +38,7 @@ class NewsController extends Controller
->where('news_categories.category_hidden', '=', 0);
})
->limit(5)
->orderBy('created_at', 'desc')
->get();
$posts = array_map(function (stdClass $row) {

View file

@ -77,7 +77,7 @@ class Category
{
if (!$this->postsCache) {
$posts = DB::table('news_posts')
->orderBy('post_id', 'desc');
->orderBy('created_at', 'desc');
if ($this->id !== 0) {
$posts->where('category_id', $this->id);