<?php

use Illuminate\Support\Facades\Route;
use App\Http\Middleware\Session;
use App\Http\Controllers\Auth\CustomLoginController;
use App\Http\Controllers\Auth\CustomRegisterController;

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider and all of them will
| be assigned to the "web" middleware group. Make something great!
|
*/

Route::get('/', function () {
    return redirect('login');
});

Route::get('/login', [CustomLoginController::class,'index'])->name('login');
Route::post('login',[CustomLoginController::class,'post_login'])->name('post_login');
Route::get('register',[CustomRegisterController::class,'index'])->name('register');
Route::post('register',[CustomRegisterController::class,'post_register'])->name('post_register');

Route::middleware(Session::class)->name('modules.')->group(function () {

    include_route_files(__DIR__ . '/modules');

    Route::get('logout',[CustomLoginController::class,'logout'])->name('logout');
});

// Auth::routes();
// Route::get('/home', [App\Http\Controllers\HomeController::class, 'index'])->name('home');
