Update (views): Fix bug, add world logic

This commit is contained in:
2023-07-26 22:27:10 +08:00
parent 9ebecd7a8f
commit 1c917b865d
6 changed files with 6 additions and 7 deletions

View File

@@ -49,6 +49,7 @@ class Category extends Model
'name', 'name',
'short_name', 'short_name',
'slug', 'slug',
'description',
'enabled', 'enabled',
'is_top', 'is_top',
'_lft', '_lft',

View File

@@ -37,6 +37,8 @@ class CountryLocale extends Model
'name', 'name',
'slug', 'slug',
'i18n', 'i18n',
'lang',
'country_iso',
'enabled', 'enabled',
]; ];
} }

View File

@@ -15,7 +15,7 @@ public function compose(View $view)
if (is_null($current_country_locale)) 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(); $categories = Category::where('country_locale_id', $current_country_locale->id)->get();

View File

@@ -20,10 +20,9 @@ public function compose(View $view)
} }
else 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) $view->with('country_locales', $country_locales)
->with('current_country_locale', $current_country_locale); ->with('current_country_locale', $current_country_locale);

View File

@@ -5,7 +5,7 @@
<div class="row justify-content-center text-center"> <div class="row justify-content-center text-center">
<div class="col-12 col-lg-8 py-5"> <div class="col-12 col-lg-8 py-5">
<h2 class="h3 fw-bold">ProductAlert is the place to be for top rated product reviews with recommendation such <h2 class="h3 fw-bold">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) }}.</h2> 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) }}.</h2>
</div> </div>
</div> </div>
</div> </div>

View File

@@ -41,9 +41,6 @@
<div class="p-3"> <div class="p-3">
<ul class="navbar-nav justify-content-end flex-grow-1 pe-3"> <ul class="navbar-nav justify-content-end flex-grow-1 pe-3">
<li class="nav-item">
<a class="nav-link active" aria-current="page" href="#">Home</a>
</li>
@foreach ($categories as $category) @foreach ($categories as $category)
<li class="nav-item"> <li class="nav-item">
<a class="nav-link active" aria-current="page" href="{{ route('home.country.category', ['country' => $category->country_locale_slug, 'category' => $category->slug ]) }}">{{ $category->name }}</a> <a class="nav-link active" aria-current="page" href="{{ route('home.country.category', ['country' => $category->country_locale_slug, 'category' => $category->slug ]) }}">{{ $category->name }}</a>