Split rank pay rate into separate rates for acars and manual flights

This commit is contained in:
Nabeel Shahzad
2018-02-27 14:29:45 -06:00
parent 81b867fa20
commit dfa6d6da51
6 changed files with 54 additions and 19 deletions

View File

@@ -5,6 +5,9 @@
namespace App\Services;
use App\Models\Enums\PirepSource;
use App\Models\Pirep;
class FinanceService extends BaseService
{
private $fareSvc,
@@ -22,4 +25,19 @@ class FinanceService extends BaseService
$this->fareSvc = $fareSvc;
$this->flightSvc = $flightSvc;
}
/**
* Return the pilot's hourly pay for the given PIREP
* @param Pirep $pirep
*/
public function getPayForPirep(Pirep $pirep)
{
# Get the base rate for the rank
$rank = $pirep->user->rank;
if($pirep->source === PirepSource::ACARS) {
$base_rate = $rank->acars_base_pay_rate;
} else {
$base_rate = $rank->manual_base_pay_rate;
}
}
}