9a28cf22ff
* Update EventServiceProvider.php Add FareListener * Create Fares.php * Create FareListener.php * Update ExpenseListener.php * Update PirepFinanceService.php Add listener for the fares, process them like the custom expenses and apply if there are any returned
40 lines
924 B
PHP
40 lines
924 B
PHP
<?php
|
|
|
|
namespace App\Listeners;
|
|
|
|
use App\Contracts\Listener;
|
|
use App\Events\Fares;
|
|
use App\Models\Enums\FareType;
|
|
use App\Models\Fare;
|
|
|
|
class FareListener extends Listener
|
|
{
|
|
/**
|
|
* Return a list of additional fares/income items
|
|
*
|
|
* @param Fares $event
|
|
*
|
|
* @return mixed
|
|
*/
|
|
public function handle(Fares $event)
|
|
{
|
|
$fares = [];
|
|
|
|
// This is an example of a fare to return
|
|
// You have the pirep on $event->pirep and any associated data
|
|
// Cost may be skipped at all if not needed
|
|
// Notes will be used as transaction group and it is how it will show as a line item
|
|
/*
|
|
$fares[] = new Fare([
|
|
'name' => 'Duty Free Sales',
|
|
'type' => FareType::PASSENGER,
|
|
'price' => 985,
|
|
'cost' => 126,
|
|
'notes' => 'InFlight Sales',
|
|
]);
|
|
*/
|
|
|
|
return $fares;
|
|
}
|
|
}
|