++ Primo Caricamento

This commit is contained in:
2026-03-30 19:15:13 +02:00
commit 663a68d59b
47 changed files with 3561 additions and 0 deletions

44
app/Models/Setting.php Normal file
View File

@@ -0,0 +1,44 @@
<?php
namespace App\Models;
// ─────────────────────────────────────────────────────────────────────────────
// Model Setting — gestisce le impostazioni dinamiche dell'applicazione
//
// Ogni riga della tabella `settings` è una coppia chiave-valore.
// Esempio:
// key: "items_per_page" value: "15"
// key: "currency_symbol" value: "€"
//
// I valori sono sempre stringhe nel DB. SettingService gestisce il cast
// al tipo corretto (int, bool, string, ecc.) basandosi su config/settings.php
// ─────────────────────────────────────────────────────────────────────────────
use Illuminate\Database\Eloquent\Model;
class Setting extends Model
{
protected $table = 'settings';
protected $fillable = [
'key',
'value',
'label', // Nome leggibile mostrato nel pannello admin
'group', // Gruppo di appartenenza (es. "Azienda", "Visualizzazione")
'type', // Tipo dato: string, integer, boolean, text
];
// Non usiamo timestamps per le impostazioni (semplifica la tabella)
public $timestamps = true;
// ─── Scope: cerca per chiave ──────────────────────────────────────────
public function scopeForKey($query, string $key)
{
return $query->where('key', $key);
}
public function scopeInGroup($query, string $group)
{
return $query->where('group', $group);
}
}