<?php

use App\Http\Controllers\Admin\CityController;
use App\Http\Controllers\Admin\DashController;
use App\Http\Controllers\admin\StateController;
use App\Http\Controllers\HomeController;
use Illuminate\Support\Facades\Route;
use Illuminate\Support\Facades\Auth;

/*
|--------------------------------------------------------------------------
| 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!
|
*/


Auth::routes();
Route::get('/', [HomeController::class, 'index'])->name('home');



// User Routes
Route::group(['as' => 'user.', 'prefix' => 'user',"middleware" => ['auth', 'allow_user:1,2', 'check_status']], function () {

});



// Admin Routes
Route::group(['as' => 'admin.', 'prefix' => 'admin',"middleware" => ['auth', 'allow_user:1', 'check_status']], function () {

    Route::get('dashboard', [DashController::class, 'index'])->name('dashboard');
    Route::post('get-states', [DashController::class, 'get_states'])->name('get_states');
    Route::resource('city', CityController::class);
    Route::resource('state', StateController::class);
});
