From 020c85fe7d241ed496e347c19c32ce9ce43e3294 Mon Sep 17 00:00:00 2001 From: Ale Date: Wed, 14 Jul 2021 22:33:14 -0300 Subject: [PATCH] segundo commit --- app/Models/Dia.php | 8 ++++++++ app/Models/Evento.php | 11 +++++++++++ app/Models/HoraFlag.php | 4 ++++ 3 files changed, 23 insertions(+) diff --git a/app/Models/Dia.php b/app/Models/Dia.php index 83f55dc..f7cd43b 100644 --- a/app/Models/Dia.php +++ b/app/Models/Dia.php @@ -8,4 +8,12 @@ use Illuminate\Database\Eloquent\Model; class Dia extends Model { use HasFactory; + + public function evento() { + return $this->belongsTo(Evento::class); + } + + public function horaFlags() { + return $this->hasMany(HoraFlag::class); + } } diff --git a/app/Models/Evento.php b/app/Models/Evento.php index 69a58f5..4ebd85c 100644 --- a/app/Models/Evento.php +++ b/app/Models/Evento.php @@ -8,4 +8,15 @@ use Illuminate\Database\Eloquent\Model; class Evento extends Model { use HasFactory; + + public function dias() { + return $this->hasMany(Dia::class); + } + + public function coordinar() { + foreach ($this->dias() as $dia) { + //guardar (nombre, horario, cantidad) + + } + } } diff --git a/app/Models/HoraFlag.php b/app/Models/HoraFlag.php index 4fe5917..ae93af0 100644 --- a/app/Models/HoraFlag.php +++ b/app/Models/HoraFlag.php @@ -8,4 +8,8 @@ use Illuminate\Database\Eloquent\Model; class HoraFlag extends Model { use HasFactory; + + public function dia() { + return $this->belongsTo(Dia::class); + } }