<?php
/**
 * Created by PhpStorm.
 * User: radko
 * Date: 15.11.18
 * Time: 14:40
 */

namespace Seka\Vzdelavanie\Composers\Kniznica;

use Illuminate\View\View;
use Seka\Vzdelavanie\Services\KategoriaServiceInterface;

/**
 * Class ZoznamKategoriiComposer
 * @package Seka\Vzdelavanie\Composers\Kniznica
 */
class ZoznamKategoriiComposer
{
    /**
     * @var \Seka\Vzdelavanie\Services\KategoriaServiceInterface
     */
    private $service;

    /**
     * ZoznamKategoriiComposer constructor.
     * @param \Seka\Vzdelavanie\Services\KategoriaServiceInterface $service
     */
    public function __construct(KategoriaServiceInterface $service)
    {
        $this->service = $service;
    }

    /**
     * @param \Illuminate\View\View $view
     *
     * @return \Illuminate\View\View
     */
    public function compose(View $view): View
    {
        return $view->with('zoznamKategorii', $this->service->vratVsetky());
    }
}
