modifiche siderbar e correzioni

This commit is contained in:
2026-05-26 12:28:39 +02:00
parent f088dba4bf
commit 85dd9c2ee6
119 changed files with 14461 additions and 42 deletions
+5
View File
@@ -38,6 +38,11 @@ class Evento extends Model
'is_incontro_gruppo' => 'boolean',
];
public function tipologiaEvento(): BelongsTo
{
return $this->belongsTo(TipologiaEvento::class, 'tipo_evento', 'nome');
}
public function tenant(): BelongsTo
{
return $this->belongsTo(Tenant::class);
+35
View File
@@ -0,0 +1,35 @@
<?php
declare(strict_types=1);
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;
class TipologiaEvento extends Model
{
protected $table = 'tipologie_eventi';
protected $fillable = ['nome', 'descrizione', 'ordine', 'attiva'];
protected $casts = [
'attiva' => 'boolean',
'ordine' => 'integer',
];
public function eventi(): HasMany
{
return $this->hasMany(Evento::class, 'tipo_evento', '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();
}
}