MAJOR IMPLEMENTATION COMPLETED: ✅ Modern database structure with Laravel best practices ✅ Complete Eloquent relationships (Amministratore→Stabili→Movements) ✅ 8-character alphanumeric codes system (ADM, ANA, MOV, ALL prefixes) ✅ Multi-database architecture for administrators ✅ Complete property management (anagrafica_condominiale, diritti_reali, contratti) ✅ Distribution system for multi-server deployment ✅ Universal responsive UI with permission-based sidebar NEW MODELS & MIGRATIONS: - AnagraficaCondominiale: Complete person/entity management - ContattoAnagrafica: Multi-contact system with usage flags - DirittoReale: Property rights with quotas and percentages - ContrattoLocazione: Rental contracts with landlord/tenant - TipoUtilizzo: Property usage types (residential, commercial, etc.) - Enhanced Stabile: Cadastral data, SDI, rate configuration - Enhanced UnitaImmobiliare: Modern structure with backward compatibility SERVICES & CONTROLLERS: - DistributionService: Multi-server deployment and migration - FileManagerController: Administrator folder management - DistributionController: API for server-to-server communication - MultiDatabaseService: Dynamic database connections READY FOR PRODUCTION: ✅ Database schema: Complete and tested ✅ Models relationships: All working and verified ✅ Code generation: Automatic 8-char codes implemented ✅ Testing: Successful data creation confirmed ✅ Documentation: Complete internal technical docs NEXT PHASE: Millésimal tables, expense categories, cost distribution engine
53 lines
1.1 KiB
PHP
53 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
|
|
class TipoUtilizzo extends Model
|
|
{
|
|
use HasFactory, SoftDeletes;
|
|
|
|
protected $table = 'tipi_utilizzo';
|
|
|
|
protected $fillable = [
|
|
'codice',
|
|
'descrizione',
|
|
'note',
|
|
'attivo',
|
|
'configurazioni_default'
|
|
];
|
|
|
|
protected $casts = [
|
|
'attivo' => 'boolean',
|
|
'configurazioni_default' => 'array'
|
|
];
|
|
|
|
/**
|
|
* Unità immobiliari con questo tipo di utilizzo
|
|
*/
|
|
public function unitaImmobiliari(): HasMany
|
|
{
|
|
return $this->hasMany(UnitaImmobiliare::class, 'tipo_utilizzo_id');
|
|
}
|
|
|
|
/**
|
|
* Scope per tipi attivi
|
|
*/
|
|
public function scopeAttivi($query)
|
|
{
|
|
return $query->where('attivo', true);
|
|
}
|
|
|
|
/**
|
|
* Ottiene la configurazione default per un campo specifico
|
|
*/
|
|
public function getConfigurazioneDefault(string $campo, $default = null)
|
|
{
|
|
return $this->configurazioni_default[$campo] ?? $default;
|
|
}
|
|
}
|