<?php

/*
|--------------------------------------------------------------------------
| 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::middleware('auth')->group(function(){
    Route::get('/', function () {
        return view('index');
    });
    Route::prefix('kelola')->group(function () {
        Route::prefix('user')->group(function () {
            Route::get('/', 'UserController@index');
            Route::post('/tambah', 'UserController@tambah');
            Route::get('{id}/edit', 'UserController@edit');
            Route::post('{id}/update', 'UserController@update');
            Route::get('{id}/delete', 'UserController@delete');
        });
        
        Route::prefix('barcode')->group(function () {
            Route::get('/', 'BarcodeController@index');
            Route::post('/tambah', 'BarcodeController@tambah');
            Route::get('{id}/edit', 'BarcodeController@edit');
            Route::post('{id}/update', 'BarcodeController@update');
            Route::get('{id}/delete', 'BarcodeController@delete');
            Route::get('{id}/aktifkan', 'BarcodeController@aktifkan');
        });
        
        Route::prefix('berita')->group(function () {
            Route::get('/', 'BeritaServerController@index');
            Route::post('/tambah', 'BeritaServerController@tambah');
            Route::get('{id}/edit', 'BeritaServerController@edit');
            Route::post('{id}/update', 'BeritaServerController@update');
            Route::get('{id}/delete', 'BeritaServerController@delete');
        });
        
        Route::prefix('lokasi')->group(function () {
            Route::get('/', 'LokasiServerController@index');
        });
    });
});

 // Authentication Routes...
    Route::get('login', 'Auth\LoginController@showLoginForm')->name('login');
    Route::post('login', 'Auth\LoginController@login');
    Route::post('logout', 'Auth\LoginController@logout')->name('logout');


    // Password Reset Routes...
    Route::get('password/reset', 'Auth\ForgotPasswordController@showLinkRequestForm')->name('password.request');
    Route::post('password/email', 'Auth\ForgotPasswordController@sendResetLinkEmail')->name('password.email');
    Route::get('password/reset/{token}', 'Auth\ResetPasswordController@showResetForm')->name('password.reset');
    Route::post('password/reset', 'Auth\ResetPasswordController@reset');

Route::get('/home', 'HomeController@index')->name('home');
