Add (country category)

This commit is contained in:
2023-07-26 11:15:28 +08:00
parent 2c42553599
commit 9ebecd7a8f
4 changed files with 112 additions and 6 deletions

View File

@@ -2,6 +2,7 @@
namespace App\View\Composers;
use App\Models\CountryLocale;
use App\Models\Category;
use Illuminate\View\View;
@@ -10,6 +11,16 @@ class CategoryComposer
{
public function compose(View $view)
{
$current_country_locale = request()->session()->get('view_country_locale');
if (is_null($current_country_locale))
{
$current_country_locale = CountryLocale::where('slug', config('platform.general.fallback_country_slug'));
}
$categories = Category::where('country_locale_id', $current_country_locale->id)->get();
$view->with('categories', $categories);
}
}