From 60d71c2b66371a096d731cce412d1bbecce76605 Mon Sep 17 00:00:00 2001 From: Charles T Date: Tue, 1 Aug 2023 03:03:52 +0800 Subject: [PATCH] Update (post): Sort by publish date --- app/Http/Controllers/Front/HomeController.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/Http/Controllers/Front/HomeController.php b/app/Http/Controllers/Front/HomeController.php index 90a82e9..6665f1b 100644 --- a/app/Http/Controllers/Front/HomeController.php +++ b/app/Http/Controllers/Front/HomeController.php @@ -46,7 +46,7 @@ public function country(Request $request, $country) ->where('categories.country_locale_slug', $country_locale->slug) ->where('posts.featured', true) ->where('posts.status', 'publish') - ->orderBy('posts.updated_at', 'desc') + ->orderBy('posts.publish_date', 'desc') ->take(3) ->get(); @@ -58,7 +58,7 @@ public function country(Request $request, $country) ->where('categories.country_locale_slug', $country_locale->slug) ->whereNotIn('posts.id', $featured_posts->pluck('id')->toArray()) ->where('posts.status', 'publish') - ->orderBy('posts.updated_at', 'desc') + ->orderBy('posts.publish_date', 'desc') ->distinct() ->take(10) ->get(); @@ -102,7 +102,7 @@ public function countryCategory(Request $request, $country, $category) ->where('categories.country_locale_slug', $country_locale->slug) ->where('categories.id', $category->id) ->where('posts.status', 'publish') - ->orderBy('posts.updated_at', 'desc') + ->orderBy('posts.publish_date', 'desc') ->distinct() ->paginate(15); @@ -133,7 +133,7 @@ public function all(Request $request, $country) ->whereNotNull('categories.id') ->where('categories.country_locale_slug', $country_locale->slug) ->where('posts.status', 'publish') - ->orderBy('posts.updated_at', 'desc') + ->orderBy('posts.publish_date', 'desc') ->distinct() ->paginate(15);