All 6 Mod modules now register API routes via ApiRoutesRegistering instead of WebRoutesRegistering with CSRF hacks. The api middleware group (ThrottleRequests + SubstituteBindings, no CSRF/session) handles everything natively. Website/Api module simplified to just metrics and homepage. fireApiRoutes() added to Web Boot. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
28 lines
686 B
PHP
28 lines
686 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Mod\Gateway;
|
|
|
|
use Core\Events\ApiRoutesRegistering;
|
|
use Core\Events\FrameworkBooted;
|
|
use Illuminate\Support\Facades\Route;
|
|
use Mod\Gateway\Services\GatewayRegistry;
|
|
|
|
class Boot
|
|
{
|
|
public static array $listens = [
|
|
ApiRoutesRegistering::class => 'onApiRoutes',
|
|
FrameworkBooted::class => 'onFrameworkBooted',
|
|
];
|
|
|
|
public function onApiRoutes(ApiRoutesRegistering $event): void
|
|
{
|
|
$event->routes(fn () => Route::prefix('v1/gateway')->group(__DIR__ . '/Routes/api.php'));
|
|
}
|
|
|
|
public function onFrameworkBooted(FrameworkBooted $event): void
|
|
{
|
|
app()->singleton(GatewayRegistry::class);
|
|
}
|
|
}
|