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
66 lines
1.5 KiB
PHP
Executable File
66 lines
1.5 KiB
PHP
Executable File
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Attributes\Fillable;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
|
|
|
/**
|
|
* Versioned legal document (Terms of Use, Privacy Policy, Cookie Policy).
|
|
*
|
|
* Bodies are stored per language so that the UI can render the version
|
|
* matching the user's selected locale at acceptance time.
|
|
*/
|
|
#[Fillable(['type', 'version', 'title', 'body', 'is_current', 'published_at'])]
|
|
class LegalDocument extends Model
|
|
{
|
|
/**
|
|
* Document type: Terms of Use.
|
|
*
|
|
* @var string
|
|
*/
|
|
public const TYPE_TERMS = 'terms';
|
|
|
|
/**
|
|
* Document type: Privacy Policy (LGPD).
|
|
*
|
|
* @var string
|
|
*/
|
|
public const TYPE_PRIVACY = 'privacy';
|
|
|
|
/**
|
|
* Document type: Cookie Policy.
|
|
*
|
|
* @var string
|
|
*/
|
|
public const TYPE_COOKIES = 'cookies';
|
|
|
|
/**
|
|
* Attributes that should be cast to native types.
|
|
*
|
|
* @return array<string, string>
|
|
*/
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'title' => 'array',
|
|
'body' => 'array',
|
|
'is_current' => 'boolean',
|
|
'published_at' => 'datetime',
|
|
];
|
|
}
|
|
|
|
/**
|
|
* Users that accepted this document version.
|
|
*
|
|
* @return BelongsToMany<User, $this>
|
|
*/
|
|
public function users(): BelongsToMany
|
|
{
|
|
return $this->belongsToMany(User::class, 'user_consents')
|
|
->withPivot(['accepted_at', 'ip_address', 'user_agent', 'source'])
|
|
->withTimestamps();
|
|
}
|
|
}
|