add pirep events model
This commit is contained in:
@@ -87,6 +87,11 @@ class Pirep extends Model
|
|||||||
return $this->belongsTo('App\Models\Airport', 'dpt_airport_id');
|
return $this->belongsTo('App\Models\Airport', 'dpt_airport_id');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function events()
|
||||||
|
{
|
||||||
|
return $this->hasMany('App\Models\PirepEvent', 'pirep_id');
|
||||||
|
}
|
||||||
|
|
||||||
public function fields()
|
public function fields()
|
||||||
{
|
{
|
||||||
return $this->hasMany('App\Models\PirepFieldValues', 'pirep_id');
|
return $this->hasMany('App\Models\PirepFieldValues', 'pirep_id');
|
||||||
|
|||||||
@@ -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');
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user