<?php

declare(strict_types=1);

namespace Seka\Portal\Modul\Vzdelavanie\Http\Controllers\Frontend\Testovanie;

use Seka\Portal\Modul\Vzdelavanie\Http\Controllers\Controller;
use Seka\Portal\Modul\Vzdelavanie\Models\Testovanie\Test;

/**
 * Class TestController
 *
 * @package Seka\Portal\Modul\Vzdelavanie\Http\Controllers\Frontend\Testovanie
 */
final class TestController extends Controller
{
    /**
     * @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\Contracts\View\View|\Illuminate\View\View
     * @throws \Illuminate\Contracts\Container\BindingResolutionException
     */
    public function index()
    {
        return view('Vzdelavanie::pages.testovanie.index');
    }

    /**
     * @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\Contracts\View\View|\Illuminate\Foundation\Application|\Illuminate\View\View
     * @throws \Illuminate\Contracts\Container\BindingResolutionException
     */
    public function zoznamTestov()
    {
        $testy = Test::query()
            ->publikovany()
            ->orderBy('nazov')
            ->get();

        return view('Vzdelavanie::pages.testovanie.zoznam.index', compact('testy'));
    }
}
