CRolfe Posted September 1, 2020 Report Share Posted September 1, 2020 I'm trying to figure out how I can modify the app controllers code to following fuel "tankering" logic. What I have done so far was create another field on the PIREP submit labeled block_in_fuel. That seems to be working fine. But now I want the PirepFinanceService to look for the previous pirep for that aircraft. Is there a function like that already built I could use to accomplish finding that record? From there I assume I would so something like ...$fuel_used = $pirep->block_fuel - $prevpirep->block_in_fuel I'm a huge noob to Laravel. So any pointers would be appreciated. Quote Link to comment Share on other sites More sharing options...
mahir Posted September 22, 2020 Report Share Posted September 22, 2020 After line 154 of App\Services\Finance\PirepFinanceService.php, Just add this code. I think it should work. $aircraft_id = $pirep->aircraft->id; $prev_pirep = Pirep::select('block_in_fuel')->where('aircraft_id', $aircraft_id)->first(); $fuel_used = $pirep->block_fuel - $prev_pirep->block_in_fuel; Quote Link to comment Share on other sites More sharing options...
Administrators Nabeel Posted September 24, 2020 Administrators Report Share Posted September 24, 2020 Is that also an additional fuel used you want to do? It's probably better to do that in a module listening to one of the PIREP events. That way it won't get overwritten. Edit: Sorry, just realized we already talked and you opened that Github issue. I'll be adding that in. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.