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
48 lines
1.6 KiB
PHP
Executable File
48 lines
1.6 KiB
PHP
Executable File
<?php
|
|
|
|
namespace App\Http\Requests;
|
|
|
|
use Illuminate\Contracts\Validation\ValidationRule;
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
use Illuminate\Validation\Rule;
|
|
|
|
/**
|
|
* Validates creation and update payloads for city stores.
|
|
*/
|
|
class StoreRequest extends FormRequest
|
|
{
|
|
/**
|
|
* Determine if the user is authorized to make this request.
|
|
*/
|
|
public function authorize(): bool
|
|
{
|
|
// Authorization is enforced by role middleware in the route file.
|
|
return $this->user() !== null;
|
|
}
|
|
|
|
/**
|
|
* Get the validation rules that apply to the request.
|
|
*
|
|
* @return array<string, ValidationRule|array<mixed>|string>
|
|
*/
|
|
public function rules(): array
|
|
{
|
|
$storeId = $this->route('store')?->id ?? $this->route('store');
|
|
|
|
return [
|
|
'name' => ['required', 'string', 'max:160'],
|
|
'description' => ['nullable', 'string', 'max:2000'],
|
|
'type' => ['required', 'string', 'max:60'],
|
|
'owner_id' => ['nullable', 'integer', Rule::exists('users', 'id')],
|
|
'agent_id' => ['nullable', 'integer', Rule::exists('ai_agents', 'id')],
|
|
'pos_x' => ['required', 'numeric', 'between:-100000,100000'],
|
|
'pos_y' => ['required', 'numeric', 'between:-100000,100000'],
|
|
'pos_z' => ['required', 'numeric', 'between:-100000,100000'],
|
|
'width' => ['nullable', 'numeric', 'min:0.1', 'max:1000'],
|
|
'height' => ['nullable', 'numeric', 'min:0.1', 'max:1000'],
|
|
'depth' => ['nullable', 'numeric', 'min:0.1', 'max:1000'],
|
|
'is_open' => ['nullable', 'boolean'],
|
|
];
|
|
}
|
|
}
|