From 3a77e442eac17823d34949d57de556f16e43183d Mon Sep 17 00:00:00 2001 From: Nabeel Shahzad Date: Sun, 23 Jul 2017 13:07:41 -0500 Subject: [PATCH] add pirep events model --- app/Models/Pirep.php | 5 +++++ app/Models/PirepEvent.php | 47 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 app/Models/PirepEvent.php diff --git a/app/Models/Pirep.php b/app/Models/Pirep.php index c345572f..f2d25ab2 100644 --- a/app/Models/Pirep.php +++ b/app/Models/Pirep.php @@ -87,6 +87,11 @@ class Pirep extends Model return $this->belongsTo('App\Models\Airport', 'dpt_airport_id'); } + public function events() + { + return $this->hasMany('App\Models\PirepEvent', 'pirep_id'); + } + public function fields() { return $this->hasMany('App\Models\PirepFieldValues', 'pirep_id'); diff --git a/app/Models/PirepEvent.php b/app/Models/PirepEvent.php new file mode 100644 index 00000000..a5685351 --- /dev/null +++ b/app/Models/PirepEvent.php @@ -0,0 +1,47 @@ + 'string', + 'required' => 'integer', + ]; + + /** + * Validation rules + * + * @var array + */ + public static $rules + = [ + 'name' => 'required', + ]; + + public function pirep() + { + return $this->belongsTo('App\Models\Pirep', 'pirep_id'); + } +}