todo mal
This commit is contained in:
@@ -1,36 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class AdminUser extends Model
|
||||
{
|
||||
protected $table = 'admin_users';
|
||||
protected $primaryKey = 'id';
|
||||
public $timestamps = false;
|
||||
|
||||
protected $fillable = [
|
||||
'username',
|
||||
'password',
|
||||
'role',
|
||||
'id_club',
|
||||
'reset_token',
|
||||
'reset_expira',
|
||||
];
|
||||
|
||||
public function club()
|
||||
{
|
||||
return $this->belongsTo(Club::class, 'id_club', 'id_club');
|
||||
}
|
||||
|
||||
protected $hidden = [
|
||||
'password',
|
||||
'reset_token',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'role' => 'integer',
|
||||
'reset_expira' => 'datetime',
|
||||
];
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Aficionado extends Model
|
||||
{
|
||||
protected $table = 'aficionados';
|
||||
protected $primaryKey = 'id_aficionado';
|
||||
public $timestamps = false;
|
||||
|
||||
protected $fillable = [
|
||||
'nombre',
|
||||
'apellido',
|
||||
'dni',
|
||||
'fecha_nacimiento',
|
||||
'email',
|
||||
'telefono',
|
||||
'localidad',
|
||||
'fecha_registro',
|
||||
'password',
|
||||
'reset_token',
|
||||
'reset_expira',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'password',
|
||||
'reset_token',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'id_aficionado' => 'integer',
|
||||
'fecha_nacimiento' => 'date',
|
||||
'fecha_registro' => 'datetime',
|
||||
'reset_expira' => 'datetime',
|
||||
];
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class AgentThread extends Model
|
||||
{
|
||||
protected $table = 'agent_threads';
|
||||
|
||||
protected $fillable = [
|
||||
'thread_id',
|
||||
'admin_id',
|
||||
'messages',
|
||||
'expires_at',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'messages' => 'array',
|
||||
'expires_at' => 'datetime',
|
||||
];
|
||||
|
||||
public static function findOrCreateForAdmin(?string $threadId, int $adminId): static
|
||||
{
|
||||
if ($threadId) {
|
||||
$thread = static::where('thread_id', $threadId)
|
||||
->where('admin_id', $adminId)
|
||||
->first();
|
||||
if ($thread) {
|
||||
return $thread;
|
||||
}
|
||||
}
|
||||
|
||||
return static::create([
|
||||
'thread_id' => (string) Str::uuid(),
|
||||
'admin_id' => $adminId,
|
||||
'messages' => [],
|
||||
'expires_at' => now()->addDays(30),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class CarouselItem extends Model
|
||||
{
|
||||
protected $table = 'carousel_items';
|
||||
|
||||
protected $fillable = [
|
||||
'titulo',
|
||||
'subtitulo',
|
||||
'boton_texto',
|
||||
'boton_enlace',
|
||||
'imagen',
|
||||
'orden',
|
||||
'activo',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'activo' => 'boolean',
|
||||
'orden' => 'integer',
|
||||
];
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Categoria extends Model
|
||||
{
|
||||
protected $table = 'categorias';
|
||||
protected $primaryKey = 'id_categoria';
|
||||
|
||||
protected $fillable = [
|
||||
'nombre',
|
||||
'edad_min',
|
||||
'edad_max',
|
||||
'genero',
|
||||
'es_libre'
|
||||
];
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
<?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');
|
||||
}
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Configuracion extends Model
|
||||
{
|
||||
protected $table = 'configuraciones';
|
||||
|
||||
protected $fillable = [
|
||||
'clave',
|
||||
'valor',
|
||||
'descripcion',
|
||||
];
|
||||
|
||||
/**
|
||||
* Obtener un valor de configuración por su clave.
|
||||
*
|
||||
* @param string $clave
|
||||
* @param mixed $default
|
||||
* @return mixed
|
||||
*/
|
||||
public static function get($clave, $default = null)
|
||||
{
|
||||
$config = self::where('clave', $clave)->first();
|
||||
return $config ? $config->valor : $default;
|
||||
}
|
||||
|
||||
/**
|
||||
* Establecer o actualizar un valor de configuración.
|
||||
*
|
||||
* @param string $clave
|
||||
* @param mixed $valor
|
||||
* @param string|null $descripcion
|
||||
* @return self
|
||||
*/
|
||||
public static function set($clave, $valor, $descripcion = null)
|
||||
{
|
||||
return self::updateOrCreate(
|
||||
['clave' => $clave],
|
||||
['valor' => $valor, 'descripcion' => $descripcion]
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class Equipo extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
protected $table = 'equipos';
|
||||
protected $primaryKey = 'id_equipo';
|
||||
public $timestamps = true;
|
||||
|
||||
protected $fillable = [
|
||||
'id_club',
|
||||
'categoria',
|
||||
'division',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'id_equipo' => 'integer',
|
||||
'id_club' => 'integer',
|
||||
];
|
||||
|
||||
public function club()
|
||||
{
|
||||
return $this->belongsTo(Club::class, 'id_club', 'id_club');
|
||||
}
|
||||
|
||||
public function jugadores()
|
||||
{
|
||||
return $this->belongsToMany(Jugador::class, 'jugador_equipo', 'id_equipo', 'id_jugador')
|
||||
->withPivot('fecha_alta');
|
||||
}
|
||||
|
||||
public function torneos()
|
||||
{
|
||||
return $this->belongsToMany(Torneo::class, 'torneo_equipo', 'id_equipo', 'id_torneo');
|
||||
}
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class EquipoSeguimiento extends Model
|
||||
{
|
||||
protected $table = 'equipo_seguimiento';
|
||||
public $timestamps = false;
|
||||
|
||||
protected $fillable = [
|
||||
'id_equipo',
|
||||
'tipo_usuario',
|
||||
'id_usuario',
|
||||
'created_at',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'id_equipo' => 'integer',
|
||||
'created_at' => 'datetime',
|
||||
];
|
||||
|
||||
public function equipo()
|
||||
{
|
||||
return $this->belongsTo(Equipo::class, 'id_equipo', 'id_equipo');
|
||||
}
|
||||
}
|
||||
@@ -1,96 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Carbon\Carbon;
|
||||
|
||||
class Evento extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
protected $table = 'eventos';
|
||||
protected $primaryKey = 'id_evento';
|
||||
public $timestamps = true;
|
||||
public $incrementing = false;
|
||||
|
||||
public const FASE_REGULAR = 0;
|
||||
public const FASE_CUARTOS = 1;
|
||||
public const FASE_SEMIS = 2;
|
||||
public const FASE_FINAL = 3;
|
||||
|
||||
protected $fillable = [
|
||||
'id_evento',
|
||||
'nombre_evento',
|
||||
'fecha_evento',
|
||||
'hora_inicio',
|
||||
'hora_fin',
|
||||
'sede',
|
||||
'id_equipo_local',
|
||||
'id_equipo_visitante',
|
||||
'marcador_local',
|
||||
'marcador_visitante',
|
||||
'id_torneo',
|
||||
'precio',
|
||||
'limite_qr_jugador',
|
||||
'fase',
|
||||
'numero_partido_bracket',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'id_evento' => 'string',
|
||||
'id_torneo' => 'integer',
|
||||
'id_equipo_local' => 'integer',
|
||||
'id_equipo_visitante' => 'integer',
|
||||
'marcador_local' => 'integer',
|
||||
'marcador_visitante' => 'integer',
|
||||
'precio' => 'decimal:2',
|
||||
'fase' => 'integer',
|
||||
'numero_partido_bracket' => 'integer',
|
||||
];
|
||||
|
||||
public function getFechaEventoAttribute($value)
|
||||
{
|
||||
return $value ? Carbon::parse($value) : null;
|
||||
}
|
||||
|
||||
public function getHoraInicioAttribute($value)
|
||||
{
|
||||
return $value ? Carbon::parse($value) : null;
|
||||
}
|
||||
|
||||
public function getHoraFinAttribute($value)
|
||||
{
|
||||
return $value ? Carbon::parse($value) : null;
|
||||
}
|
||||
|
||||
public function torneo()
|
||||
{
|
||||
return $this->belongsTo(Torneo::class, 'id_torneo');
|
||||
}
|
||||
|
||||
public function equipoLocal()
|
||||
{
|
||||
return $this->belongsTo(Equipo::class, 'id_equipo_local', 'id_equipo');
|
||||
}
|
||||
|
||||
public function equipoVisitante()
|
||||
{
|
||||
return $this->belongsTo(Equipo::class, 'id_equipo_visitante', 'id_equipo');
|
||||
}
|
||||
|
||||
public function pagos()
|
||||
{
|
||||
return $this->hasMany(PagoMp::class, 'event_id', 'id_evento');
|
||||
}
|
||||
|
||||
public function qrCodes()
|
||||
{
|
||||
return $this->hasMany(QrCode::class, 'id_evento', 'id_evento');
|
||||
}
|
||||
|
||||
public function jugadoresPuntos()
|
||||
{
|
||||
return $this->hasMany(EventoJugador::class, 'id_evento', 'id_evento');
|
||||
}
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class EventoJugador extends Model
|
||||
{
|
||||
protected $table = 'evento_jugador';
|
||||
|
||||
protected $fillable = [
|
||||
'id_evento',
|
||||
'id_jugador',
|
||||
'puntos',
|
||||
'faltas'
|
||||
];
|
||||
|
||||
public function evento()
|
||||
{
|
||||
return $this->belongsTo(Evento::class, 'id_evento', 'id_evento');
|
||||
}
|
||||
|
||||
public function jugador()
|
||||
{
|
||||
return $this->belongsTo(Jugador::class, 'id_jugador', 'id_jugador');
|
||||
}
|
||||
}
|
||||
@@ -1,79 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class Jugador extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
protected $table = 'jugadores';
|
||||
protected $primaryKey = 'id_jugador';
|
||||
public $timestamps = true;
|
||||
public $incrementing = false;
|
||||
|
||||
protected $fillable = [
|
||||
'id_jugador',
|
||||
'documento',
|
||||
'nombre',
|
||||
'apellido',
|
||||
'fecha_nacimiento',
|
||||
'edad',
|
||||
'categoria',
|
||||
'id_club_actual',
|
||||
'id_club_origen',
|
||||
'activo',
|
||||
'email',
|
||||
'telefono',
|
||||
'password',
|
||||
'reset_token',
|
||||
'reset_expira',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'password',
|
||||
'reset_token',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'id_jugador' => 'string',
|
||||
'fecha_nacimiento' => 'date',
|
||||
'edad' => 'integer',
|
||||
'id_club_actual' => 'integer',
|
||||
'id_club_origen' => 'integer',
|
||||
'activo' => 'boolean',
|
||||
'reset_expira' => 'datetime',
|
||||
];
|
||||
|
||||
public function getCategoriaCalculadaAttribute()
|
||||
{
|
||||
if (!$this->fecha_nacimiento) return 'Sin categoría';
|
||||
|
||||
// Calculate age for the current year. (Categoría U15 is for players turning 14 and 15 in the current year).
|
||||
// That means current_year - birth_year
|
||||
$edadCategoria = date('Y') - $this->fecha_nacimiento->format('Y');
|
||||
|
||||
$categoria = Categoria::where('edad_min', '<=', $edadCategoria)
|
||||
->where('edad_max', '>=', $edadCategoria)
|
||||
->first();
|
||||
|
||||
return $categoria ? $categoria->nombre : 'Sin categoría';
|
||||
}
|
||||
|
||||
public function clubActual()
|
||||
{
|
||||
return $this->belongsTo(Club::class, 'id_club_actual', 'id_club');
|
||||
}
|
||||
|
||||
public function clubOrigen()
|
||||
{
|
||||
return $this->belongsTo(Club::class, 'id_club_origen', 'id_club');
|
||||
}
|
||||
|
||||
public function equipos()
|
||||
{
|
||||
return $this->belongsToMany(Equipo::class, 'jugador_equipo', 'id_jugador', 'id_equipo')
|
||||
->withPivot('fecha_alta');
|
||||
}
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class JugadorEquipo extends Model
|
||||
{
|
||||
protected $table = 'jugador_equipo';
|
||||
public $timestamps = false;
|
||||
public $incrementing = false;
|
||||
|
||||
protected $fillable = [
|
||||
'id_jugador',
|
||||
'id_equipo',
|
||||
'fecha_alta',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'id_jugador' => 'string',
|
||||
'id_equipo' => 'integer',
|
||||
'fecha_alta' => 'date',
|
||||
];
|
||||
|
||||
public function jugador()
|
||||
{
|
||||
return $this->belongsTo(Jugador::class, 'id_jugador', 'id_jugador');
|
||||
}
|
||||
|
||||
public function equipo()
|
||||
{
|
||||
return $this->belongsTo(Equipo::class, 'id_equipo', 'id_equipo');
|
||||
}
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Noticia extends Model
|
||||
{
|
||||
protected $table = 'noticias';
|
||||
protected $primaryKey = 'id';
|
||||
public $timestamps = false;
|
||||
|
||||
protected $fillable = [
|
||||
'titulo',
|
||||
'contenido',
|
||||
'imagen',
|
||||
'fecha',
|
||||
'id_torneo',
|
||||
'categoria',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'id' => 'integer',
|
||||
'fecha' => 'datetime',
|
||||
];
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Notificacion extends Model
|
||||
{
|
||||
protected $table = 'notificaciones';
|
||||
public $timestamps = false;
|
||||
|
||||
protected $fillable = [
|
||||
'tipo_destinatario',
|
||||
'id_destinatario',
|
||||
'tipo',
|
||||
'titulo',
|
||||
'mensaje',
|
||||
'url_accion',
|
||||
'leida',
|
||||
'enviada_email',
|
||||
'creada_en',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'leida' => 'boolean',
|
||||
'enviada_email' => 'boolean',
|
||||
'creada_en' => 'datetime',
|
||||
];
|
||||
|
||||
// ── Scopes ──
|
||||
public function scopeNoLeidas($query)
|
||||
{
|
||||
return $query->where('leida', false);
|
||||
}
|
||||
|
||||
public function scopeParaUsuario($query, string $tipo, $id)
|
||||
{
|
||||
return $query->where('tipo_destinatario', $tipo)->where('id_destinatario', (string)$id);
|
||||
}
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Pase extends Model
|
||||
{
|
||||
protected $table = 'pases';
|
||||
protected $primaryKey = 'id_pase';
|
||||
|
||||
protected $fillable = [
|
||||
'id_jugador',
|
||||
'id_club_origen',
|
||||
'id_club_destino',
|
||||
'estado'
|
||||
];
|
||||
|
||||
public function jugador()
|
||||
{
|
||||
return $this->belongsTo(Jugador::class, 'id_jugador', 'id_jugador');
|
||||
}
|
||||
|
||||
public function clubOrigen()
|
||||
{
|
||||
return $this->belongsTo(Club::class, 'id_club_origen', 'id_club');
|
||||
}
|
||||
|
||||
public function clubDestino()
|
||||
{
|
||||
return $this->belongsTo(Club::class, 'id_club_destino', 'id_club');
|
||||
}
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class PromoQr extends Model
|
||||
{
|
||||
protected $table = 'promo_qrs';
|
||||
protected $primaryKey = 'id_qr';
|
||||
public $timestamps = false;
|
||||
public $incrementing = false;
|
||||
|
||||
protected $fillable = [
|
||||
'id_qr',
|
||||
'id_promo',
|
||||
'id_usuario',
|
||||
'tipo_usuario',
|
||||
'generado_en',
|
||||
'usado',
|
||||
'usado_en',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'id_qr' => 'string',
|
||||
'id_promo' => 'integer',
|
||||
'id_usuario' => 'integer',
|
||||
'tipo_usuario' => 'string',
|
||||
'generado_en' => 'datetime',
|
||||
'usado' => 'boolean',
|
||||
'usado_en' => 'datetime',
|
||||
];
|
||||
|
||||
public function promocion()
|
||||
{
|
||||
return $this->belongsTo(Promocion::class, 'id_promo', 'id');
|
||||
}
|
||||
|
||||
public function usuario()
|
||||
{
|
||||
if ($this->tipo_usuario === 'jugador') {
|
||||
return $this->belongsTo(Jugador::class, 'id_usuario', 'id_jugador');
|
||||
}
|
||||
return $this->belongsTo(Aficionado::class, 'id_usuario', 'id_aficionado');
|
||||
}
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Promocion extends Model
|
||||
{
|
||||
protected $table = 'promociones';
|
||||
protected $primaryKey = 'id';
|
||||
public $timestamps = false;
|
||||
|
||||
protected $fillable = [
|
||||
'nombre',
|
||||
'direccion',
|
||||
'lat',
|
||||
'lng',
|
||||
'contacto',
|
||||
'descripcion',
|
||||
'descripcion_lugar',
|
||||
'categoria',
|
||||
'imagen',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'id' => 'integer',
|
||||
'lat' => 'decimal:8',
|
||||
'lng' => 'decimal:8',
|
||||
];
|
||||
|
||||
public function promoQrs()
|
||||
{
|
||||
return $this->hasMany(PromoQr::class, 'id_promo', 'id');
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class PushSubscription extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'id_usuario',
|
||||
'tipo_usuario',
|
||||
'endpoint',
|
||||
'p256dh',
|
||||
'auth',
|
||||
];
|
||||
|
||||
/**
|
||||
* Relación polimórfica manual (ya que no usamos el User estándar de Laravel siempre)
|
||||
*/
|
||||
public function scopeParaUsuario($query, $tipo, $id)
|
||||
{
|
||||
return $query->where('tipo_usuario', $tipo)->where('id_usuario', $id);
|
||||
}
|
||||
}
|
||||
@@ -1,48 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class QrCode extends Model
|
||||
{
|
||||
protected $table = 'qr_codes';
|
||||
protected $primaryKey = 'id_qr';
|
||||
public $timestamps = false;
|
||||
public $incrementing = false;
|
||||
|
||||
protected $fillable = [
|
||||
'id_qr',
|
||||
'id_evento',
|
||||
'id_jugador',
|
||||
'tipo_qr',
|
||||
'escaneos_restantes',
|
||||
'creado',
|
||||
'id_aficionado',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'id_qr' => 'string',
|
||||
'id_evento' => 'string',
|
||||
'id_jugador' => 'string',
|
||||
'tipo_qr' => 'string',
|
||||
'escaneos_restantes' => 'integer',
|
||||
'creado' => 'datetime',
|
||||
'id_aficionado' => 'integer',
|
||||
];
|
||||
|
||||
public function evento()
|
||||
{
|
||||
return $this->belongsTo(Evento::class, 'id_evento', 'id_evento');
|
||||
}
|
||||
|
||||
public function jugador()
|
||||
{
|
||||
return $this->belongsTo(Jugador::class, 'id_jugador', 'id_jugador');
|
||||
}
|
||||
|
||||
public function aficionado()
|
||||
{
|
||||
return $this->belongsTo(Aficionado::class, 'id_aficionado', 'id_aficionado');
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Sponsor extends Model
|
||||
{
|
||||
protected $table = 'sponsors';
|
||||
protected $primaryKey = 'id_sponsor';
|
||||
|
||||
protected $fillable = [
|
||||
'nombre',
|
||||
'imagen',
|
||||
'url',
|
||||
'activo',
|
||||
'orden',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'activo' => 'boolean',
|
||||
];
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class Torneo extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
protected $table = 'torneos';
|
||||
|
||||
protected $fillable = [
|
||||
'nombre',
|
||||
'fecha_inicio',
|
||||
'fecha_fin',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'fecha_inicio' => 'datetime',
|
||||
'fecha_fin' => 'datetime',
|
||||
];
|
||||
|
||||
public function equipos()
|
||||
{
|
||||
return $this->belongsToMany(Equipo::class, 'torneo_equipo', 'id_torneo', 'id_equipo')->withPivot('grupo');
|
||||
}
|
||||
|
||||
public function eventos()
|
||||
{
|
||||
return $this->hasMany(Evento::class, 'id_torneo');
|
||||
}
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
// use Illuminate\Contracts\Auth\MustVerifyEmail;
|
||||
use Database\Factories\UserFactory;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
|
||||
class User extends Authenticatable
|
||||
{
|
||||
/** @use HasFactory<UserFactory> */
|
||||
use HasFactory, Notifiable;
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var list<string>
|
||||
*/
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'email',
|
||||
'password',
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be hidden for serialization.
|
||||
*
|
||||
* @var list<string>
|
||||
*/
|
||||
protected $hidden = [
|
||||
'password',
|
||||
'remember_token',
|
||||
];
|
||||
|
||||
/**
|
||||
* Get the attributes that should be cast.
|
||||
*
|
||||
* @return array<string, string>
|
||||
*/
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'email_verified_at' => 'datetime',
|
||||
'password' => 'hashed',
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user