<?php

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

/*
|--------------------------------------------------------------------------
| 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::middleware('auth')
    ->group(function () {
        Route::prefix('file-manager')
            ->group(function () {
                Lfm::routes();
            });
    });
