<?php
use Modules\Artikel\Http\Controllers\ArtikelController;

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

        /* Halaman Static */
        Route::get('halaman-static', [ArtikelController::class, 'HalamanStaticIndex'])->name('HalamanStaticIndex');
        Route::post('datatableHalamanStatic', [ArtikelController::class, 'datatableHalamanStatic'])->name('datatableHalamanStatic');
        Route::get('create-halaman-static', [ArtikelController::class, 'createHalamanStatic'])->name('createHalamanStatic');
        Route::post('store-halaman-static', [ArtikelController::class, 'storeHalamanStatic'])->name('storeHalamanStatic');
        Route::get('edit-halaman-static/{id}', [ArtikelController::class, 'editHalamanStatic'])->name('editHalamanStatic');
        Route::post('update-halaman-static/{id}', [ArtikelController::class, 'updateHalamanStatic'])->name('updateHalamanStatic');
        Route::delete('delete-halaman-static/{id}', [ArtikelController::class, 'destroyHalamanStatic'])->name('destroyHalamanStatic');

        /* Kategori */
        Route::post('datatableKatgeori', [ArtikelController::class, 'datatableKatgeori'])->name('datatableKatgeori');
        Route::get('category', [ArtikelController::class, 'CategoryIndex'])->name('CategoryIndex');
        Route::get('create-category', [ArtikelController::class, 'createCategory'])->name('createCategory');
        Route::post('store-category', [ArtikelController::class, 'storeCategory'])->name('storeCategory');
        Route::get('edit-category{id}', [ArtikelController::class, 'editCategory'])->name('editCategory');
        Route::post('update-category/{id}', [ArtikelController::class, 'updateCategory'])->name('updateCategory');
        Route::delete('delete-category/{id}', [ArtikelController::class, 'destroyCategory'])->name('destroyCategory');
    });
});

