Agrego archivos iniciales

This commit is contained in:
Laucha1312
2026-06-04 14:47:50 -03:00
commit ed94601e34
76 changed files with 7737 additions and 0 deletions
+50
View File
@@ -0,0 +1,50 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
class Club extends Model
{
use SoftDeletes;
protected $table = 'clubes';
protected $primaryKey = 'id_club';
public $timestamps = true;
public $incrementing = false;
protected $fillable = [
'id_club',
'nombre',
'es_seleccion',
'estadio_id',
'imagen',
'qr_background',
'qr_color_texto',
];
protected static function boot()
{
parent::boot();
static::creating(function ($model) {
if (empty($model->id_club)) {
$model->id_club = (int) self::withTrashed()->max('id_club') + 1;
}
});
}
protected $casts = [
'id_club' => 'integer',
'es_seleccion' => 'boolean',
];
public function equipos()
{
return $this->hasMany(Equipo::class, 'id_club', 'id_club');
}
public function jugadores()
{
return $this->hasMany(Jugador::class, 'id_club_actual', 'id_club');
}
}