<?php

namespace Lavalite\Industry\Http\Controllers;

use App\Http\Controllers\PublicController as CMSPublicController;
use Lavalite\Industry\Interfaces\IndustryRepositoryInterface;

class IndustryPublicController extends CMSPublicController
{
    /**
     * Constructor.
     *
     * @param type \Lavalite\Industry\Interfaces\IndustryRepositoryInterface $industry
     *
     * @return type
     */
    public function __construct(IndustryRepositoryInterface $industry)
    {
        $this->model = $industry;
        parent::__construct();
    }

    /**
     * Show industry's list.
     *
     * @param string $slug
     *
     * @return response
     */
    protected function index()
    {
        $industries = $this->model->all();

        return $this->theme->of('industry::public.industry.index', compact('industries'))->render();
    }

    /**
     * Show industry.
     *
     * @param string $slug
     *
     * @return response
     */
    protected function show($slug)
    {
        $industry = $this->model->findBySlug($slug);

        return $this->theme->of('industry::public.industry.show', compact('industry'))->render();
    }
}