<?php

use Illuminate\Support\Facades\Route;
use App\Http\Controllers\UserController;
use App\Http\Controllers\AdminController;
use App\Http\Controllers\AbonentController;
use App\Http\Controllers\StatementController;
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 and all of them will
| be assigned to the "web" middleware group. Make something great!
|
*/

Route::get('/', function () {
    return view('index');
})->name('index');
Route::get('/login', [UserController::class, 'login'])->name('login');
Route::get('/register', [UserController::class, 'register'])->name('register');
Route::post('/createuser', [UserController::class, 'reg'])->name('createuser');
Route::post('/authuser', [UserController::class, 'auth'])->name('authuser');
Route::middleware('auth')->group(function () {
    Route::get('/statements', [StatementController::class, 'statements'])->name('statements');
    Route::post('/addstatement', [StatementController::class, 'addstatement'])->name('addstatement');
    Route::get('/logout', [UserController::class, 'logout'])->name('logout');
}); 
Route::middleware('admin')->group(function () {
    Route::get('/true={id}', [AdminController::class, 'true'])->name('true');
    Route::get('/false={id}', [AdminController::class, 'false'])->name('false');
    Route::get('/adminpanel', [AdminController::class, 'adminpanel'])->name('adminpanel');
});



