diff --git a/app/Controllers/HomeController.php b/app/Controllers/HomeController.php index 7659f4a..6a17a5c 100644 --- a/app/Controllers/HomeController.php +++ b/app/Controllers/HomeController.php @@ -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) { diff --git a/app/Controllers/NewsController.php b/app/Controllers/NewsController.php index 4719e43..3ae94db 100644 --- a/app/Controllers/NewsController.php +++ b/app/Controllers/NewsController.php @@ -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) { diff --git a/app/News/Category.php b/app/News/Category.php index 05cc0ea..bd8e481 100644 --- a/app/News/Category.php +++ b/app/News/Category.php @@ -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);