<?php

use Illuminate\Support\Facades\Route;
use UniSharp\LaravelFilemanager\Lfm;

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

Route::namespace('Auth')
    ->group(function () {
        Route::prefix('/prihlasenie')
            ->middleware('guest')
            ->name('login.')
            ->group(function () {
                Route::get('/', 'LoginController@showLoginForm')->name('form');
                Route::post('/', 'LoginController@login')->name('login');
            });

        Route::middleware('auth')
            ->group(function () {
                Route::post('/odhlasenie', 'LoginController@logout')->name('logout');
            });
    });

Route::middleware('auth')
    ->name('portal.')
    ->group(function () {
        Route::get('/', 'PlochaController@index')->name('plocha');

        Route::prefix('pouzivatel')
            ->name('pouzivatel.')
            ->group(function () {
                Route::get('notifikacie', 'PouzivatelController@index')->name('notifikacie.index');
            });

        Route::prefix('informacie')
            ->name('informacie.')
            ->group(function () {
                Route::get('/', 'InformaciaController@index')->name('index');
                Route::get('/{informaciaId}', 'InformaciaController@show')->name('show');
            });
    });

Route::middleware('auth')
    ->group(function () {
        Route::prefix('file-manager')
            ->group(function () {
                Lfm::routes();
            });
    });
