<?php

namespace App\View\Components\Navbar;

use Closure;
use Illuminate\Contracts\View\View;
use Illuminate\View\Component;

use App\Repositories\Catalog\CategoryRepository;

class Categories extends Component
{

    protected $categories = [];
    /**
     * Create a new component instance.
     */
    public function __construct()
    {
        $categoryRepository = new CategoryRepository();
        $this->categories = $categoryRepository->getList([]);
    }

    /**
     * Get the view / contents that represent the component.
     */
    public function render(): View|Closure|string
    {

        return view('components.navbar.categories', [
            'categories' => $this->categories,
        ]);
    }
}
