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',
'short_name',
'slug',
'description',
'enabled',
'is_top',
'_lft',

View File

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

View File

@@ -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();

View File

@@ -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);

View File

@@ -5,7 +5,7 @@
<div class="row justify-content-center text-center">
<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
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>

View File

@@ -41,9 +41,6 @@
<div class="p-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)
<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>