glastree_on_gitea

This commit is contained in:
2026-05-26 08:14:29 +02:00
commit 0bed099d05
9556 changed files with 1186307 additions and 0 deletions
+33
View File
@@ -0,0 +1,33 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;
class TipologiaDocumento extends Model
{
protected $table = 'tipologie_documenti';
protected $fillable = ['nome', 'descrizione', 'ordine', 'attiva'];
protected $casts = [
'attiva' => 'boolean',
'ordine' => 'integer',
];
public function documenti(): HasMany
{
return $this->hasMany(Documento::class, 'tipologia', 'nome');
}
public static function attive(): \Illuminate\Database\Eloquent\Collection
{
return static::where('attiva', true)->orderBy('ordine')->get();
}
public static function opzioni(): array
{
return static::attive()->pluck('nome')->toArray();
}
}