diff --git a/routes/api.php b/routes/api.php index 2159129..7374970 100755 --- a/routes/api.php +++ b/routes/api.php @@ -5,6 +5,7 @@ use App\Http\Controllers\CodeController; use App\Http\Controllers\InfoController; use App\Http\Middleware\CheckAdminMiddleware; +use App\Http\Middleware\VisitMiddleware; use Illuminate\Support\Facades\Route; Route::name('api.')->group(function () { @@ -13,15 +14,17 @@ Route::post('verify', [AuthController::class, 'verify'])->name('verify'); Route::resource('code', CodeController::class)->except(['create', 'edit', 'store', 'destroy']); - Route::middleware(['auth:sanctum'])->group(function () { - Route::post('token', [AuthController::class, 'token'])->name('token'); - Route::post('codes', [CodeController::class, 'codes'])->name('codes'); - Route::post('code', [CodeController::class, 'store'])->name('code'); - Route::delete('code', [CodeController::class, 'destroy'])->name('code'); - Route::post('info', [InfoController::class, 'info'])->name('info'); + Route::middleware(VisitMiddleware::class)->group(function () { + Route::middleware(['auth:sanctum'])->group(function () { + Route::post('token', [AuthController::class, 'token'])->name('token'); + Route::post('codes', [CodeController::class, 'codes'])->name('codes'); + Route::post('code', [CodeController::class, 'store'])->name('code'); + Route::delete('code', [CodeController::class, 'destroy'])->name('code'); + Route::post('info', [InfoController::class, 'info'])->name('info'); - Route::prefix("admin")->name(".admin")->middleware(CheckAdminMiddleware::class)->group(function () { - Route::post("/", [AdminController::class, "index"]); + Route::prefix("admin")->name(".admin")->middleware(CheckAdminMiddleware::class)->group(function () { + Route::post("/", [AdminController::class, "index"]); + }); }); }); });