ECOMMERCE/app/View/Components/Layout/NavbarCategory.php

47 lines
1.1 KiB
PHP

<?php
namespace App\View\Components\Layout;
use App\Repositories\Catalog\CategoryRepository;
use App\Repositories\Catalog\GenderRepository;
use App\Repositories\Catalog\BrandRepository;
use Closure;
use Illuminate\Contracts\View\View;
use Illuminate\View\Component;
class NavbarCategory extends Component
{
public $genders = [];
public $categories = [];
public $brands = [];
/**
* Create a new component instance.
*/
public function __construct()
{
//
$genderRepository = new GenderRepository();
$categoryRepository = new CategoryRepository();
$brandsRepository = new BrandRepository();
$this->genders = $genderRepository->getList(['limit' => 7]);
$this->categories = $categoryRepository->getList(['limit' => 7]);
// chunk
$this->brands = $brandsRepository->getList(['limit' => 10]);
}
/**
* Get the view / contents that represent the component.
*/
public function render(): View|Closure|string
{
return view('components.layout.navbar-category');
}
}