# πŸ›οΈ ARCHITETTURA SISTEMA - NetGescon ## Database, Modelli Laravel e Strutture ### πŸ“‹ CONTENUTI CATEGORIA: #### πŸ—„οΈ **DATABASE E RELAZIONI** - **Modelli Laravel**: Stabile, TabellaMillesimale, VoceSpesa - **Relazioni**: hasMany con eager loading corretto - **Migrazioni**: Colonne ordinamento, chiavi esterne - **Strutture**: MySQL ottimizzato per performance #### πŸ“Š **TECHNICAL_SPECS.md** - ⭐ DOCUMENTO MASTER - Architettura completa sistema - Specifiche tecniche dettagliate - Performance requirements - Stack tecnologico unificato #### πŸ”§ **CONTROLLER E ROUTING** - **StabileController**: Eager loading corretto - **Routing**: Sistema modulare - **Middleware**: Autenticazione e permessi - **API**: Endpoint REST pianificati #### 🚧 **MIGRATIONS E STRUTTURE** - Schema database completo - Seeder per dati di test - Colonne ordinamento - Indici performance --- ## 🎯 STACK TECNOLOGICO ### βœ… AMBIENTE PRODUZIONE: - **Framework**: Laravel 10.x - **Database**: MySQL 8.0 - **PHP**: 8.3.6 - **Web Server**: Apache2 + SSL - **Frontend**: Tailwind CSS + Vite - **Node.js**: Per build assets ### πŸ—οΈ ARCHITETTURA: ```php // Relazioni Corrette (FUNZIONANTE) public function tabelleMillesimali() { return $this->hasMany(TabellaMillesimale::class, 'stabile_id', 'id') ->orderBy('ordinamento')->orderBy('nome_tabella'); } // Controller con Eager Loading $stabile->load([ 'tabelleMillesimali', 'vociSpesa', 'unitaImmobiliari', 'palazzine', 'amministratore' ]); ``` --- ## πŸ“Š PERFORMANCE METRICS ### Database Records (Stabile ID: 1): - **Tabelle Millesimali**: 24 records - **Voci di Spesa**: 30 records - **UnitΓ  Immobiliari**: 50+ records - **Query Time**: < 100ms ### Load Performance: - **Page Load**: < 500ms - **Database**: Ottimizzato con indici - **Memory**: Efficient eager loading --- ## πŸ”— FILE PRINCIPALI ### Modelli: - `/var/www/netgescon/app/Models/Stabile.php` - `/var/www/netgescon/app/Models/TabellaMillesimale.php` - `/var/www/netgescon/app/Models/VoceSpesa.php` ### Controller: - `/var/www/netgescon/app/Http/Controllers/Admin/StabileController.php` ### Migrations: - `/var/www/netgescon/database/migrations/` --- **πŸ“… ULTIMO AGGIORNAMENTO: 28 Luglio 2025** **🎯 STATUS: ARCHITETTURA STABILE**