Files
City10/database/seeders/CityContentSeeder.php
T
marcocosta10000 79d12fa2f4 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
2026-10-17 20:46:15 -03:00

129 lines
4.7 KiB
PHP
Executable File

<?php
namespace Database\Seeders;
use App\Models\AiAgent;
use App\Models\Store;
use App\Models\User;
use Illuminate\Database\Seeder;
/**
* Seeds a starter set of AI agents and stores for the virtual city.
*
* Provides the Mayor, a few shopkeepers and pedestrian agents together
* with representative buildings so that the 3D scene has content to
* render on first load.
*/
class CityContentSeeder extends Seeder
{
/**
* Seed AI agents and stores.
*/
public function run(): void
{
$shopkeeper = User::where('email', 'user@sistema.net')->first();
// --- Mayor: coordinates the city at a macro level -----------------
$mayor = AiAgent::updateOrCreate(
['name' => 'Prefeito Augusto'],
[
'type' => 'mayor',
'model' => config('ai.default_model'),
'system_prompt' => 'Você é o Prefeito da cidade virtual City10. Tome decisões macro sobre infraestrutura, tráfego e qualidade de vida dos cidadãos.',
'current_goal' => 'Manter a cidade segura e próspera',
'status' => 'active',
'pos_x' => 0, 'pos_y' => 0, 'pos_z' => 0,
],
);
// --- Shopkeepers --------------------------------------------------
$baker = AiAgent::updateOrCreate(
['name' => 'Seu João — Padaria Central'],
[
'type' => 'shopkeeper',
'model' => config('ai.default_model'),
'system_prompt' => 'Você é o dono da Padaria Central. Gerencie estoque, preços e atendimento com simpatia.',
'current_goal' => 'Aumentar as vendas da manhã',
'status' => 'active',
'pos_x' => 12, 'pos_y' => 0, 'pos_z' => -8,
],
);
// --- Pedestrians --------------------------------------------------
AiAgent::updateOrCreate(
['name' => 'Nara'],
[
'type' => 'pedestrian',
'model' => config('ai.default_model'),
'system_prompt' => 'Você é a Nara, uma pedestre amigável. Converse brevemente com quem se aproximar.',
'current_goal' => 'Caminhar até a praça',
'status' => 'active',
'pos_x' => 20, 'pos_y' => 0, 'pos_z' => 10,
],
);
AiAgent::updateOrCreate(
['name' => 'Wilson'],
[
'type' => 'pedestrian',
'model' => config('ai.default_model'),
'system_prompt' => 'Você é o Wilson, um pedestre que trabalha na loja de material de construção.',
'current_goal' => 'Voltar para casa',
'status' => 'active',
'pos_x' => 6, 'pos_y' => 0, 'pos_z' => 4,
],
);
AiAgent::updateOrCreate(
['name' => 'Amanda'],
[
'type' => 'pedestrian',
'model' => config('ai.default_model'),
'system_prompt' => 'Você é a Amanda, criadora de conteúdo. Gosta de conversar sobre arte e moda.',
'current_goal' => 'Fotografe a praça para o feed',
'status' => 'active',
'pos_x' => 30, 'pos_y' => 0, 'pos_z' => 6,
],
);
// --- Stores -------------------------------------------------------
Store::updateOrCreate(
['name' => 'Padaria Central'],
[
'description' => 'Pães frescos e cafés desde 1998.',
'type' => 'bakery',
'owner_id' => $shopkeeper?->id,
'agent_id' => $baker->id,
'pos_x' => 12, 'pos_y' => 0, 'pos_z' => -12,
'width' => 8, 'height' => 6, 'depth' => 8,
'is_open' => true,
],
);
Store::updateOrCreate(
['name' => 'Mercado Municipal'],
[
'description' => 'Produtos frescos e itens do dia a dia.',
'type' => 'market',
'owner_id' => $shopkeeper?->id,
'agent_id' => $mayor->id,
'pos_x' => -18, 'pos_y' => 0, 'pos_z' => 14,
'width' => 14, 'height' => 8, 'depth' => 12,
'is_open' => true,
],
);
Store::updateOrCreate(
['name' => 'Loja de Materiais da Esquina'],
[
'description' => 'Material de construção e ferramentas.',
'type' => 'hardware',
'owner_id' => $shopkeeper?->id,
'pos_x' => 8, 'pos_y' => 0, 'pos_z' => 6,
'width' => 10, 'height' => 7, 'depth' => 10,
'is_open' => true,
],
);
}
}