Refactor code structure for improved readability and maintainability

This commit is contained in:
2026-10-19 16:25:15 +02:00
parent 2ed2c0389d
commit a8aa6d9927
50 changed files with 1164 additions and 8 deletions
+31
View File
@@ -0,0 +1,31 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;
class Sistema extends Model
{
protected $table = 'sistemi';
protected $fillable = [
'codice', 'nome', 'ordine', 'attivo',
];
protected $casts = [
'ordine' => 'integer',
'attivo' => 'boolean',
];
public function modelli(): HasMany
{
return $this->hasMany(Modello::class);
}
public function scopeAttivi(Builder $query): Builder
{
return $query->where('attivo', true)->orderBy('ordine')->orderBy('id');
}
}