<?php

declare(strict_types=1);

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

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

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

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

        return view('Vzdelavanie::pages.testovanie.zoznam.index')
            ->withTesty($testy);
    }
}
