add pirep events model

This commit is contained in:
Nabeel Shahzad 2017-07-23 13:07:41 -05:00
parent 346ed2dd85
commit 3a77e442ea
2 changed files with 52 additions and 0 deletions

View File

@ -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');

47
app/Models/PirepEvent.php Normal file
View File

@ -0,0 +1,47 @@
<?php
namespace App\Models;
use Eloquent as Model;
/**
* Class PirepEvent
*
* @package App\Models
*/
class PirepEvent extends Model
{
public $table = 'pirep_fields';
public $fillable
= [
'name',
'value',
];
/**
* The attributes that should be casted to native types.
*
* @var array
*/
protected $casts
= [
'name' => 'string',
'required' => 'integer',
];
/**
* Validation rules
*
* @var array
*/
public static $rules
= [
'name' => 'required',
];
public function pirep()
{
return $this->belongsTo('App\Models\Pirep', 'pirep_id');
}
}