specify fares, js to dynamically change fare form; get applicable fares for the flight/pirep #125

This commit is contained in:
Nabeel Shahzad
2018-02-24 15:38:25 -06:00
parent 910c0e0eab
commit 58e0f50c48
28 changed files with 1063 additions and 265 deletions

View File

@@ -283,6 +283,11 @@ class Pirep extends BaseModel
->orderBy('created_at', 'desc');
}
public function fares()
{
return $this->hasMany(PirepFare::class, 'pirep_id');
}
public function fields()
{
return $this->hasMany(PirepFieldValues::class, 'pirep_id');

41
app/Models/PirepFare.php Normal file
View File

@@ -0,0 +1,41 @@
<?php
namespace App\Models;
/**
* Class PirepFare
* @package App\Models
*/
class PirepFare extends BaseModel
{
public $table = 'pirep_fares';
public $timestamps = false;
public $fillable = [
'pirep_id',
'fare_id',
'count',
];
protected $casts = [
'count' => 'integer',
];
public static $rules = [
'count' => 'required',
];
/**
* Relationships
*/
public function fare()
{
return $this->belongsTo(Fare::class, 'fare_id');
}
public function pirep()
{
return $this->belongsTo(Pirep::class, 'pirep_id');
}
}