middleware('throttle:5,1') ->name('auth.login'); Route::middleware(['auth:sanctum', 'throttle:60,1'])->group(function () { Route::get('auth/me', [AuthController::class, 'me'])->name('auth.me'); Route::post('auth/logout', [AuthController::class, 'logout'])->name('auth.logout'); }); /* |-------------------------------------------------------------------------- | Public read API |-------------------------------------------------------------------------- | Anonymous, cacheable, GET-only. Nothing here can change state. */ Route::middleware('throttle:60,1')->group(function () { Route::prefix('website')->group(function () { Route::get('about-me', [AboutMeController::class, 'index']); Route::get('about-me/{id}', [AboutMeController::class, 'show']); Route::get('about-me/{id}/translation/{locale}', [AboutMeController::class, 'getTranslation']); Route::get('project-categories', [ProjectCategoryController::class, 'index']); Route::get('services/{locale}', [ServiceController::class, 'index']); Route::get('services/{id}/translation/{locale}', [ServiceController::class, 'showTranslation']); Route::get('projects/translation/{locale}', [ProjectController::class, 'index']); Route::get('projects/{id}/translation/{locale}', [ProjectController::class, 'show']); }); Route::prefix('blog')->group(function () { Route::get('homepage', [HomeController::class, 'index']); Route::get('posts', [PostController::class, 'index']); Route::get('posts/{slug}', [PostController::class, 'show']); Route::get('categories', [CategoryController::class, 'index']); Route::get('categories/{id}', [CategoryController::class, 'show']); Route::get('categories/{slug}/posts', [CategoryController::class, 'getCategoryWithPosts']); Route::get('tags', [TagController::class, 'index']); Route::get('tags/{id}', [TagController::class, 'show']); }); }); /* |-------------------------------------------------------------------------- | Admin write API |-------------------------------------------------------------------------- | Every mutating endpoint requires an authenticated admin. These routes were | previously anonymous, which allowed anyone to create, edit or delete every | post, category, tag, project and about-me record on the live site. */ Route::middleware(['auth:sanctum', 'admin', 'throttle:30,1'])->group(function () { Route::prefix('website')->group(function () { Route::post('about-me', [AboutMeController::class, 'store']); Route::put('about-me/{id}', [AboutMeController::class, 'update']); Route::delete('about-me/{id}', [AboutMeController::class, 'destroy']); Route::post('projects', [ProjectController::class, 'store']); Route::put('projects/{id}', [ProjectController::class, 'update']); Route::delete('projects/{id}', [ProjectController::class, 'destroy']); }); Route::prefix('blog')->group(function () { Route::post('posts', [PostController::class, 'store']); Route::put('posts/{id}', [PostController::class, 'update']); Route::delete('posts/{id}', [PostController::class, 'destroy']); Route::post('categories', [CategoryController::class, 'store']); Route::put('categories/{id}', [CategoryController::class, 'update']); Route::delete('categories/{id}', [CategoryController::class, 'destroy']); Route::post('tags', [TagController::class, 'store']); Route::put('tags/{id}', [TagController::class, 'update']); Route::delete('tags/{id}', [TagController::class, 'destroy']); }); Route::get('admin/resources/{resource}', [AdminResourceController::class, 'index']); });