Initial commit of the complete City10 virtual city simulation platform. Backend (Laravel 13): - REST API with Sanctum tokens and session-based web authentication - Role-based access control (admin/user) with middleware protection - AI agent CRUD with OpenRouter.ai integration restricted to free models - Store management with 3D coordinates and AI shopkeeper assignment - Versioned legal documents (Terms, Privacy, Cookies) with LGPD audit trail - Math CAPTCHA on public forms and multi-language support (pt_BR, en, es) Frontend: - Responsive Blade templates with Tailwind CSS v4 - Three.js 3D city viewer with SSE chat streaming to AI agents - Admin panel for store and user administration Infrastructure: - MariaDB/MySQL database with comprehensive migrations - Database seeders for demo content and test accounts - PHPUnit test suite and Laravel Pint code styling - Vite build configuration with hot reload
50 lines
1.7 KiB
PHP
Executable File
50 lines
1.7 KiB
PHP
Executable File
<?php
|
|
|
|
use App\Http\Middleware\EnsureTermsAccepted;
|
|
use App\Http\Middleware\EnsureUserIsActive;
|
|
use App\Http\Middleware\EnsureUserIsAdmin;
|
|
use App\Http\Middleware\SetLocale;
|
|
use Illuminate\Foundation\Application;
|
|
use Illuminate\Foundation\Configuration\Exceptions;
|
|
use Illuminate\Foundation\Configuration\Middleware;
|
|
use Illuminate\Http\Request;
|
|
|
|
return Application::configure(basePath: dirname(__DIR__))
|
|
->withRouting(
|
|
web: __DIR__.'/../routes/web.php',
|
|
api: __DIR__.'/../routes/api.php',
|
|
commands: __DIR__.'/../routes/console.php',
|
|
health: '/up',
|
|
)
|
|
->withMiddleware(function (Middleware $middleware): void {
|
|
// Alias custom middleware so they can be referenced by short name.
|
|
$middleware->alias([
|
|
'active' => EnsureUserIsActive::class,
|
|
'admin' => EnsureUserIsAdmin::class,
|
|
'terms' => EnsureTermsAccepted::class,
|
|
]);
|
|
|
|
// Apply "active" (account status) and "locale" (language) to web.
|
|
$middleware->web(append: [
|
|
EnsureUserIsActive::class,
|
|
SetLocale::class,
|
|
]);
|
|
|
|
// The cookie-consent flag is written by client-side JS (plain value),
|
|
// so it must not be encrypted/decrypted by the framework.
|
|
$middleware->encryptCookies(except: [
|
|
'city10-consent',
|
|
'city10-locale',
|
|
]);
|
|
|
|
// Apply "locale" to API requests too (after auth so user is known).
|
|
$middleware->api(append: [
|
|
SetLocale::class,
|
|
]);
|
|
})
|
|
->withExceptions(function (Exceptions $exceptions): void {
|
|
$exceptions->shouldRenderJsonWhen(
|
|
fn (Request $request) => $request->is('api/*') || $request->expectsJson(),
|
|
);
|
|
})->create();
|