Add subfleet data when single bid is retrieved

This commit is contained in:
Nabeel Shahzad 2022-02-04 14:13:40 -05:00
parent 8a94d8db7b
commit 74a1b4d753
2 changed files with 11 additions and 1 deletions

View File

@ -10,6 +10,8 @@ use Carbon\Carbon;
* @property string flight_id
* @property Carbon created_at
* @property Carbon updated_at
* @property Flight flight
* @property User user
*/
class Bid extends Model
{

View File

@ -48,7 +48,15 @@ class BidService extends Service
'flight.subfleets.fares',
];
return Bid::with($with)->where(['id' => $bid_id])->first();
/** @var Bid $bid */
$bid = Bid::with($with)->where(['id' => $bid_id])->first();
// Reconcile the aircraft for this bid
// TODO: Only do this if there isn't a Simbrief attached?
$bid->flight = $this->flightSvc->filterSubfleets($user, $bid->flight);
$bid->flight = $this->fareSvc->getReconciledFaresForFlight($bid->flight);
return $bid;
}
/**