<?php

use Illuminate\Support\Facades\Route;
use Illuminate\Support\Facades\Auth ;
use App\Http\Controllers\UserController;
use App\Http\Controllers\AdminController;
use App\Http\Controllers\ApplyController;

// Route::get('/', function () { return view('index'); })->name('index');
Route::get('/register', [UserController::class, 'login'])->name('register');
Route::get('/login', [UserController::class, 'login'])->name('login');

Route::get('/', [UserController::class, 'categories'])->name('index');

Route::post('/createuser', [UserController::class, 'reg'])->name('createuser');
Route::post('/authuser', [UserController::class, "auth"])->name("authuser");

Route::middleware('auth')->group(function () {
    Route::get('/account', [UserController::class, 'account'])->name("account");
    Route::get('/apply', [UserController::class, 'categories'])->name('apply');
    Route::post('/addapply', [ApplyController::class, 'addapply'])->name('addapply');
    Route::get('/myapply', [ApplyController::class, 'myapply'])->name('myapply');
    Route::get('/logout', [UserController::class, "logout"])->name("logout");

    Route::post('/account', [AdminController::class, "addcategory"])->name('addcategory');
    Route::get('/accept={id}', [AdminController::class, 'status'])->name('accept');
    Route::get('/decline={id}', [AdminController::class, 'status'])->name('decline');
});