<?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::get('/', function () {
    return view('welcome');
});

Route::group(['middleware' => 'auth'], function () {
    //    Route::get('/link1', function ()    {
//        // Uses Auth Middleware
//    });

    //Please do not remove this if you want adminlte:route and adminlte:link commands to works correctly.
    #adminlte_routes
});

Route::group(['middleware' => ['web','auth']], function(){
    Route::get('/home', 'HomeController@index');
    Route::get('/', function () {
         // if(Auth::user()->role == 'admin'){
         //            return view('adminlte::home');
         //        } elseif(Auth::user()->role == 'customer'){
         //            return redirect()->intended('user_home');
         //        } elseif(Auth::user()->role == 'kasir'){
         //            return redirect()->intended('kasir');
         //        } elseif(Auth::user()->role == 'inventori'){
         //            return redirect()->intended('inventori');
         //        }
         //         else {
         //            return redirect()->intended('pelayan');
         //        }
        // if (Auth::user()->role=='admin'){
        //     return view('adminlte::admin');
        // }else if(Auth::user()->role=='user'){
        //     return view('adminlte::user_home');
        // }else if(Auth::user()->role=='kasir'){
        //     return view('adminlte::kasir');
        // }

        if (Auth::user()->status=='admin'){
            return view('adminlte::admin.index');
        }else if(Auth::user()->status=='user'){
            return view('adminlte::customer.index');
        }else if(Auth::user()->status=='kasir'){
            return view('adminlte::kasir.index');
        }else if(Auth::user()->status=='inventori'){
            return view('adminlte::inventori.index');
        }
    });
});

// Route::group(['middleware' => ['web','auth','admin']], function () {
//     Route::get('/daftarPegawai', 'OrderController@index');
// });