Deploy Ladill Hosting / deploy (push) Successful in 1m29s
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>
35 lines
1.6 KiB
PHP
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)];
|
|
});
|
|
});
|