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.6 KiB
PHP
Executable File
66 lines
1.6 KiB
PHP
Executable File
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Database\Factories\StoreFactory;
|
|
use Illuminate\Database\Eloquent\Attributes\Fillable;
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
/**
|
|
* Physical store placed inside the 3D city.
|
|
*
|
|
* Each store has an exact (x, y, z) world coordinate, footprint dimensions
|
|
* and an optional AI shopkeeper agent controlling its commercial behaviour.
|
|
*/
|
|
#[Fillable([
|
|
'name', 'description', 'type', 'owner_id', 'agent_id',
|
|
'pos_x', 'pos_y', 'pos_z', 'width', 'height', 'depth',
|
|
'is_open', 'revenue',
|
|
])]
|
|
class Store extends Model
|
|
{
|
|
/** @use HasFactory<StoreFactory> */
|
|
use HasFactory;
|
|
|
|
/**
|
|
* Owner (shopkeeper) account.
|
|
*
|
|
* @return BelongsTo<User, $this>
|
|
*/
|
|
public function owner(): BelongsTo
|
|
{
|
|
return $this->belongsTo(User::class, 'owner_id');
|
|
}
|
|
|
|
/**
|
|
* AI agent controlling the store, when assigned.
|
|
*
|
|
* @return BelongsTo<AiAgent, $this>
|
|
*/
|
|
public function agent(): BelongsTo
|
|
{
|
|
return $this->belongsTo(AiAgent::class, 'agent_id');
|
|
}
|
|
|
|
/**
|
|
* Get the attributes that should be cast to native types.
|
|
*
|
|
* @return array<string, string>
|
|
*/
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'pos_x' => 'float',
|
|
'pos_y' => 'float',
|
|
'pos_z' => 'float',
|
|
'width' => 'float',
|
|
'height' => 'float',
|
|
'depth' => 'float',
|
|
'revenue' => 'float',
|
|
'is_open' => 'boolean',
|
|
];
|
|
}
|
|
}
|