Skip to content

Commit

Permalink
feat(visit): add visit middleware
Browse files Browse the repository at this point in the history
  • Loading branch information
tikrack committed Jan 29, 2025
1 parent 57d39e7 commit ba40941
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions routes/api.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 () {
Expand All @@ -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"]);
});
});
});
});
Expand Down

0 comments on commit ba40941

Please sign in to comment.