specify fares, js to dynamically change fare form; get applicable fares for the flight/pirep #125
This commit is contained in:
@@ -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
41
app/Models/PirepFare.php
Normal 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');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user