<?php

namespace Cert\Certification\Http\Controllers;

use App\Http\Controllers\PublicController as CMSPublicController;
use Cert\Certification\Interfaces\CertificationsRepositoryInterface;

class CertificationsPublicController extends CMSPublicController
{
    /**
     * Constructor.
     *
     * @param type \Cert\Certifications\Interfaces\CertificationsRepositoryInterface $certifications
     *
     * @return type
     */
    public function __construct(CertificationsRepositoryInterface $certifications)
    {
        $this->model = $certifications;
        parent::__construct();
    }

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

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

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

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