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'); + } +}