feat: add City10 platform with Laravel 13, AI agents, 3D viewer, and LGPD compliance
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
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Web;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\App;
|
||||
|
||||
/**
|
||||
* Language switcher controller.
|
||||
*
|
||||
* Persists the selected locale (pt_BR, en, es) in the session and in the
|
||||
* user's profile when authenticated, so the whole UI is rendered in the
|
||||
* language chosen from the dashboard or the public pages.
|
||||
*/
|
||||
class LanguageController extends Controller
|
||||
{
|
||||
/**
|
||||
* Switch the application locale for the current visitor.
|
||||
*/
|
||||
public function switch(Request $request): RedirectResponse
|
||||
{
|
||||
$locale = $request->input('locale');
|
||||
|
||||
if (! in_array($locale, ['pt_BR', 'en', 'es'], true)) {
|
||||
return back();
|
||||
}
|
||||
|
||||
App::setLocale($locale);
|
||||
$request->session()->put('locale', $locale);
|
||||
|
||||
if ($user = $request->user()) {
|
||||
$user->update(['locale' => $locale]);
|
||||
}
|
||||
|
||||
// Persist the cookie preference (1 year) used on subsequent visits.
|
||||
$response = back();
|
||||
$response->withCookie(cookie('city10-locale', $locale, 60 * 24 * 365, '/', null, false, true));
|
||||
|
||||
return $response;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user