Update (post): Sort by publish date

This commit is contained in:
2023-08-01 03:03:52 +08:00
parent 599847bfa2
commit 60d71c2b66

View File

@@ -46,7 +46,7 @@ public function country(Request $request, $country)
->where('categories.country_locale_slug', $country_locale->slug) ->where('categories.country_locale_slug', $country_locale->slug)
->where('posts.featured', true) ->where('posts.featured', true)
->where('posts.status', 'publish') ->where('posts.status', 'publish')
->orderBy('posts.updated_at', 'desc') ->orderBy('posts.publish_date', 'desc')
->take(3) ->take(3)
->get(); ->get();
@@ -58,7 +58,7 @@ public function country(Request $request, $country)
->where('categories.country_locale_slug', $country_locale->slug) ->where('categories.country_locale_slug', $country_locale->slug)
->whereNotIn('posts.id', $featured_posts->pluck('id')->toArray()) ->whereNotIn('posts.id', $featured_posts->pluck('id')->toArray())
->where('posts.status', 'publish') ->where('posts.status', 'publish')
->orderBy('posts.updated_at', 'desc') ->orderBy('posts.publish_date', 'desc')
->distinct() ->distinct()
->take(10) ->take(10)
->get(); ->get();
@@ -102,7 +102,7 @@ public function countryCategory(Request $request, $country, $category)
->where('categories.country_locale_slug', $country_locale->slug) ->where('categories.country_locale_slug', $country_locale->slug)
->where('categories.id', $category->id) ->where('categories.id', $category->id)
->where('posts.status', 'publish') ->where('posts.status', 'publish')
->orderBy('posts.updated_at', 'desc') ->orderBy('posts.publish_date', 'desc')
->distinct() ->distinct()
->paginate(15); ->paginate(15);
@@ -133,7 +133,7 @@ public function all(Request $request, $country)
->whereNotNull('categories.id') ->whereNotNull('categories.id')
->where('categories.country_locale_slug', $country_locale->slug) ->where('categories.country_locale_slug', $country_locale->slug)
->where('posts.status', 'publish') ->where('posts.status', 'publish')
->orderBy('posts.updated_at', 'desc') ->orderBy('posts.publish_date', 'desc')
->distinct() ->distinct()
->paginate(15); ->paginate(15);