<?php

use App\Http\Controllers\Admin\PageMenuController;
use App\Http\Controllers\Auth\MemberController;
use App\Http\Middleware\RoleMenuMiddleware;
use Illuminate\Support\Facades\Route;

// Route::get('/', function () {
//     // return view('welcome');
//     // return view('admin.app', ['menus' => []]);
// });
// Route::group(['prefix' => '/', 'middleware' => ['auth', 'RoleMenuMiddleware']], function () {
//     Route::get('/', [PageMenuController::class, 'dashboard'])->name('dashboard');
// });
Route::get('/', [PageMenuController::class, 'dashboard'])->name('dashboard')->middleware(RoleMenuMiddleware::class);

Route::middleware('guest')->group(function () {
    // Menampilkan form login
    Route::get('/login', [MemberController::class, 'showLoginForm'])->name('login');
    // Memproses login
    Route::post('/login', [MemberController::class, 'do_login']);
});
Route::get('/logout', [MemberController::class, 'logout'])->name('logout');
