<?php

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

/*
|--------------------------------------------------------------------------
| 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('/', [FrontController::class,'index'])->name('index');
Route::get('/search', [FrontController::class,'search'])->name('search');
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::get('getInstansi/{type}',[AjaxController::class,'getInstansi'])->name('getInstansi');

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');
