@extends('layouts.admin')
@section('title') {{__('words.Add Brand')}} @endsection
@push('page_style')
@endpush
@section('content')
@php
$AllGeneralCategories = [];
$genCat = [];
$lang = session('locale');
$langFile = resource_path("lang/$lang/category.php");
$translations = include $langFile;
@endphp
@foreach (collect(getcategoryList())->slice(4) as $category)
@if ($category->slug != 'services' && $category->slug != 'jobs')
@php
$cat = \App\Models\Category::where('parent_id', $category->id + 1)
->where('has_brand', 1)
->get();
if ($cat->isNotEmpty()) {
$subCats = [];
foreach ($cat as $catItem) {
$findSubGeneralCategory = \App\Models\Category::where('parent_id', $catItem->id)
->where('has_brand', 1)
->get();
if ($findSubGeneralCategory->isNotEmpty()) {
$subSubCats = [];
foreach ($findSubGeneralCategory as $subCatItem) {
$findSubSubGeneralCategory = \App\Models\Category::where('parent_id', $subCatItem->id)
->where('has_brand', 1)
->get();
if ($findSubSubGeneralCategory->isNotEmpty()) {
$subSubSubCats = [];
foreach ($findSubSubGeneralCategory as $subSubCatItem) {
$findSubSubSubGeneralCategory = \App\Models\Category::where('parent_id', $subSubCatItem->id)
->where('has_brand', 1)
->get();
if ($findSubSubSubGeneralCategory->isEmpty()) {
$data = [];
$data["id"] = $subSubCatItem->id;
$data["title"] = $translations[$subSubCatItem->title] ?? $subSubCatItem->title;
$data["slug"] = $subSubCatItem->slug;
$subSubSubCats[] = $data;
}
}
$AllGeneralCategories[] = [
'general_category' =>
($translations[$category->title] ?? $category->title) . ' >> ' .
($translations[$catItem->title] ?? $catItem->title) . ' >> ' .
($translations[$subCatItem->title] ?? $subCatItem->title),
'sub_cat' => $subSubSubCats,
];
} else {
$data = [];
$data["id"] = $subCatItem->id;
$data["title"] = $translations[$subCatItem->title] ?? $subCatItem->title;
$data["slug"] = $subCatItem->slug;
$subSubCats[] = $data;
}
}
$AllGeneralCategories[] = [
'general_category' =>
($translations[$category->title] ?? $category->title) . ' >> ' .
($translations[$catItem->title] ?? $catItem->title),
'sub_cat' => $subSubCats,
];
} else {
$data = [];
$data["id"] = $catItem->id;
$data["title"] = $translations[$catItem->title] ?? $catItem->title;
$data["slug"] = $catItem->slug;
$subCats[] = $data;
}
}
$AllGeneralCategories[] = [
'general_category' => $translations[$category->title] ?? $category->title,
'sub_cat' => $subCats,
];
} else {
$data = [];
$data["id"] = $category->id;
$data["title"] = $translations[$category->title] ?? $category->title;
$data["slug"] = $category->slug;
$genCat[] = $data;
}
@endphp
@endif
@endforeach
@php
$AllGeneralCategories[] = [
'general_category' => $translations["General"] ?? "General",
'sub_cat' => $genCat
];
@endphp
@php
$AllGeneralCategories = collect($AllGeneralCategories)
->sortBy('general_category', SORT_NATURAL | SORT_FLAG_CASE)
->values()
->all();
@endphp
@php
// $boatBrands = App\Models\BoatMake::all();
// $sportsBrands = App\Models\SportsActivitiesBrand::all();
// $caravansBrands = App\Models\CaravansMake::all();
// $electronicBrands = App\Models\ElectronicBrand::all();
// $carBrands = App\Models\Brand::all();
// $booksBrands = App\Models\BooksMusicMoviesBrand::all();
// $healthBeautyBrands = App\Models\HealthBeautyBrand::all();
// $homeGardenBrands = App\Models\HomeGardenBrand::all();
// $foodBrands = App\Models\FoodBeveragesBrand::all();
// $toysBrands = App\Models\ToysGamesBrand::all();
// $petsBrands = App\Models\PetsAnimalsBrand::all();
// $clothBrands = App\Models\ClothingFashionBrand::all();
// $watchesBrands = App\Models\WatchesJeweleryBrand::all();
// $businessIndustrialBrands = App\Models\BusinessIndustrialBrand::all();
// $rentalCarBrands = App\Models\RentalCarsBrand::all();
// $carVehicleBrands = App\Models\CarsVehiclesBrand::all();
// $otherBrands = App\Models\OthersBrand::all();
// $businessIndustrialBrands = App\Models\BusinessIndustrialBrand::all();
// $allBrands = $boatBrands
// ->union($sportsBrands)
// ->union($caravansBrands);
// ->union($electronicBrands)
// ->union($carBrands)
// ->union($booksBrands)
// ->union($healthBeautyBrands)
// ->union($homeGardenBrands)
// ->union($foodBrands)
// ->union($toysBrands)
// ->union($petsBrands)
// ->union($clothBrands)
// ->union($watchesBrands)
// ->union($businessIndustrialBrands)
// ->union($rentalCarBrands)
// ->union($carVehicleBrands)
// ->union($otherBrands);
$carModels = App\Models\CarModel::all();
$carVehicleModels = App\Models\CarsVehiclesModel::all();
$rentalCarModels = App\Models\RentalCarsModel::all();
$allModels = $carModels->union($carVehicleModels)->union($rentalCarModels);
@endphp
{{-- select Cateories to add brand --}}
@push('page_script')
@endpush
@endsection