<?php

use Modules\Pengguna\Http\Controllers\PenggunaController;

/*
|--------------------------------------------------------------------------
| 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::prefix('admin')->group(function(){
    Route::prefix('pengguna')->name('pengguna.')->middleware(['auth', 'checkRole:Superadmin'])->group(function() {
        Route::get('/', [PenggunaController::class, 'index'])->name('index');
        Route::get('create', [PenggunaController::class, 'create'])->name('create');
        Route::post('store', [PenggunaController::class, 'store'])->name('store');
        Route::get('edit/{id}', [PenggunaController::class, 'edit'])->name('edit');
        Route::post('update/{id}', [PenggunaController::class, 'update'])->name('update');
        Route::delete('delete/{id}', [PenggunaController::class, 'destroy'])->name('destroy');
        Route::post('datatable', [PenggunaController::class, 'datatable'])->name('datatable');
    });
});

