ECOMMERCE/app/View/Components/Grocery/HeaderCategoryDropdown.php

37 lines
942 B
PHP

<?php
namespace App\View\Components\Grocery;
use App\Repositories\Catalog\CategoryRepository;
use App\Repositories\Catalog\GenderRepository;
use Closure;
use Illuminate\Contracts\View\View;
use Illuminate\View\Component;
class HeaderCategoryDropdown extends Component
{
protected $categories = [];
protected $genders = [];
/**
* Create a new component instance.
*/
public function __construct(CategoryRepository $categoryRepository, GenderRepository $genderRepository)
{
$this->categories = $categoryRepository->getList([]);
$this->genders = $genderRepository->getList([]);
}
/**
* Get the view / contents that represent the component.
*/
public function render(): View|Closure|string
{
return view('components.grocery.header-category-dropdown', [
'categories' => $this->categories,
'genders' => $this->genders,
]);
}
}