Files
ladill-hosting/routes/api.php
T
isaaccladandCursor 2c9877a87c
Deploy Ladill Hosting / deploy (push) Successful in 1m29s
Add platform admin hosting API for Ladill account provisioning.
Expose authenticated service endpoints for assigning, listing, renewing, and managing hosting accounts from the platform, with tests and deploy docs.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-03 22:54:00 +00:00

35 lines
1.6 KiB
PHP

<?php
use App\Http\Controllers\Api\PlatformHostingController;
use App\Services\Mailbox\MailboxClient;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;
Route::middleware('auth.service:platform')->prefix('platform')->group(function (): void {
Route::get('/hosting-products', [PlatformHostingController::class, 'products']);
Route::get('/users/{publicId}/hosting-accounts', [PlatformHostingController::class, 'index'])
->where('publicId', '[A-Za-z0-9\-]+');
Route::post('/users/{publicId}/hosting-accounts', [PlatformHostingController::class, 'assign'])
->where('publicId', '[A-Za-z0-9\-]+');
Route::patch('/hosting-accounts/{account}/duration', [PlatformHostingController::class, 'updateDuration'])
->whereNumber('account');
Route::post('/hosting-accounts/{account}/renew', [PlatformHostingController::class, 'renew'])
->whereNumber('account');
Route::post('/hosting-accounts/{account}/unsuspend', [PlatformHostingController::class, 'unsuspend'])
->whereNumber('account');
});
// Ladill Email API (v1) — authenticated with Sanctum personal access tokens
// minted on the Developers page. Read-only for now: identity + mailboxes.
Route::middleware('auth:sanctum')->prefix('v1')->group(function () {
Route::get('/me', function (Request $request) {
$u = $request->user();
return ['id' => $u->public_id, 'name' => $u->name, 'email' => $u->email];
});
Route::get('/mailboxes', function (Request $request, MailboxClient $mailboxes) {
return ['data' => $mailboxes->forUser((string) $request->user()->public_id)];
});
});