Airline <> Aircraft Relationships (#1338)
* Aircraft relationship * Airline relationship * Flight and Pirep Relationships * Style and logic fix
This commit is contained in:
parent
471464272f
commit
f498ad3bba
@ -115,11 +115,21 @@ class Aircraft extends Model
|
||||
/**
|
||||
* foreign keys
|
||||
*/
|
||||
public function airline()
|
||||
{
|
||||
return $this->belongsToThrough(Airline::class, Subfleet::class);
|
||||
}
|
||||
|
||||
public function airport()
|
||||
{
|
||||
return $this->belongsTo(Airport::class, 'airport_id');
|
||||
}
|
||||
|
||||
public function pireps()
|
||||
{
|
||||
return $this->hasMany(Pirep::class, 'aircraft_id');
|
||||
}
|
||||
|
||||
public function subfleet()
|
||||
{
|
||||
return $this->belongsTo(Subfleet::class, 'subfleet_id');
|
||||
|
@ -103,6 +103,11 @@ class Airline extends Model
|
||||
return $this->hasMany(Subfleet::class, 'airline_id');
|
||||
}
|
||||
|
||||
public function aircraft()
|
||||
{
|
||||
return $this->hasManyThrough(Aircraft::class, Subfleet::class);
|
||||
}
|
||||
|
||||
public function flights()
|
||||
{
|
||||
return $this->belongsTo(Flight::class, 'airline_id');
|
||||
|
Loading…
Reference in New Issue
Block a user