add pirep events model
This commit is contained in:
parent
346ed2dd85
commit
3a77e442ea
@ -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
47
app/Models/PirepEvent.php
Normal 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');
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user