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