From 1c917b865d5c1f11c6a670ead20614cb4db5719f Mon Sep 17 00:00:00 2001 From: Charles T Date: Wed, 26 Jul 2023 22:27:10 +0800 Subject: [PATCH] Update (views): Fix bug, add world logic --- app/Models/Category.php | 1 + app/Models/CountryLocale.php | 2 ++ app/View/Composers/CategoryComposer.php | 2 +- app/View/Composers/CountryLocaleComposer.php | 3 +-- resources/views/front/country.blade.php | 2 +- resources/views/layouts/front/navigation.blade.php | 3 --- 6 files changed, 6 insertions(+), 7 deletions(-) diff --git a/app/Models/Category.php b/app/Models/Category.php index 09f2d1b..e6a14a4 100644 --- a/app/Models/Category.php +++ b/app/Models/Category.php @@ -49,6 +49,7 @@ class Category extends Model 'name', 'short_name', 'slug', + 'description', 'enabled', 'is_top', '_lft', diff --git a/app/Models/CountryLocale.php b/app/Models/CountryLocale.php index c06e415..d74b457 100644 --- a/app/Models/CountryLocale.php +++ b/app/Models/CountryLocale.php @@ -37,6 +37,8 @@ class CountryLocale extends Model 'name', 'slug', 'i18n', + 'lang', + 'country_iso', 'enabled', ]; } diff --git a/app/View/Composers/CategoryComposer.php b/app/View/Composers/CategoryComposer.php index 9e9e5a5..30d00e7 100644 --- a/app/View/Composers/CategoryComposer.php +++ b/app/View/Composers/CategoryComposer.php @@ -15,7 +15,7 @@ public function compose(View $view) if (is_null($current_country_locale)) { - $current_country_locale = CountryLocale::where('slug', config('platform.general.fallback_country_slug')); + $current_country_locale = CountryLocale::where('slug', config('platform.general.fallback_country_slug'))->first(); } $categories = Category::where('country_locale_id', $current_country_locale->id)->get(); diff --git a/app/View/Composers/CountryLocaleComposer.php b/app/View/Composers/CountryLocaleComposer.php index 99ba956..317fd3c 100644 --- a/app/View/Composers/CountryLocaleComposer.php +++ b/app/View/Composers/CountryLocaleComposer.php @@ -20,10 +20,9 @@ public function compose(View $view) } else { - $current_country_locale = CountryLocale::where('slug', config('platform.general.fallback_country_slug')); + $current_country_locale = CountryLocale::where('slug', config('platform.general.fallback_country_slug'))->first(); } - $view->with('country_locales', $country_locales) ->with('current_country_locale', $current_country_locale); diff --git a/resources/views/front/country.blade.php b/resources/views/front/country.blade.php index b793fb7..199aaff 100644 --- a/resources/views/front/country.blade.php +++ b/resources/views/front/country.blade.php @@ -5,7 +5,7 @@

ProductAlert is the place to be for top rated product reviews with recommendation such - as the right price, latest trend, from the best brands in {{ get_country_name_by_iso($country_locale->country_iso) }}.

+ as the right price, latest trend, from the best brands from {{ ($country_locale->country_iso == '*') ? 'the whole world' :get_country_name_by_iso($country_locale->country_iso) }}.
diff --git a/resources/views/layouts/front/navigation.blade.php b/resources/views/layouts/front/navigation.blade.php index 0fe3f5d..a003024 100644 --- a/resources/views/layouts/front/navigation.blade.php +++ b/resources/views/layouts/front/navigation.blade.php @@ -41,9 +41,6 @@