This commit is contained in:
2023-11-26 18:56:40 +08:00
parent be14f5fdb1
commit 64431e7a73
144 changed files with 497072 additions and 3730 deletions

View File

@@ -3,22 +3,20 @@
namespace App\View\Composers;
use App\Models\Category;
use App\Models\CountryLocale;
use Illuminate\View\View;
class CategoryComposer
{
public function compose(View $view)
{
$current_country_locale = request()->session()->get('view_country_locale');
$parent_categories = Category::whereNull('parent_id')->orderBy('name', 'ASC')->get();
if (is_null($current_country_locale)) {
$current_country_locale = CountryLocale::where('slug', config('platform.general.fallback_country_slug'))->first();
}
$top_parent_categories = clone $parent_categories->where('is_top', true);
$non_top_parent_categories = clone $parent_categories->where('is_top', false);
$categories = Category::where('country_locale_id', $current_country_locale->id)->get();
$view->with('categories', $categories);
$view->with('parent_categories', $parent_categories)
->with('top_parent_categories', $top_parent_categories)
->with('non_top_parent_categories', $non_top_parent_categories);
}
}

View File

@@ -0,0 +1,16 @@
<?php
namespace App\View\Composers;
use Illuminate\View\View;
class StatsComposer
{
public function compose(View $view)
{
$tools_count = round_to_nearest_base(700);
$view->with('tools_count', $tools_count);
}
}