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.2 KiB
PHP
Executable File
50 lines
1.2 KiB
PHP
Executable File
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Attributes\Fillable;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
/**
|
|
* Immutable audit record of a user consent event.
|
|
*
|
|
* Captures which legal document version was accepted, when, from which IP
|
|
* and through which channel, enabling full LGPD accountability.
|
|
*/
|
|
#[Fillable(['user_id', 'legal_document_id', 'accepted_at', 'ip_address', 'user_agent', 'source'])]
|
|
class UserConsent extends Model
|
|
{
|
|
/**
|
|
* Attributes that should be cast to native types.
|
|
*
|
|
* @return array<string, string>
|
|
*/
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'accepted_at' => 'datetime',
|
|
];
|
|
}
|
|
|
|
/**
|
|
* User that granted the consent.
|
|
*
|
|
* @return BelongsTo<User, $this>
|
|
*/
|
|
public function user(): BelongsTo
|
|
{
|
|
return $this->belongsTo(User::class);
|
|
}
|
|
|
|
/**
|
|
* Legal document version that was accepted.
|
|
*
|
|
* @return BelongsTo<LegalDocument, $this>
|
|
*/
|
|
public function document(): BelongsTo
|
|
{
|
|
return $this->belongsTo(LegalDocument::class, 'legal_document_id');
|
|
}
|
|
}
|