phpvms/app/Listeners/ExpenseListener.php
B.Fatih KOZ 9a28cf22ff
Add Custom Fares (#1323)
* 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
2021-09-30 11:10:05 -04:00

36 lines
829 B
PHP

<?php
namespace App\Listeners;
use App\Contracts\Listener;
use App\Events\Expenses;
use App\Models\Enums\ExpenseType;
use App\Models\Expense;
class ExpenseListener extends Listener
{
/**
* Return a list of additional expenses
*
* @param Expenses $event
*
* @return mixed
*/
public function handle(Expenses $event)
{
$expenses = [];
// This is an example of an expense to return
// You have the pirep on $event->pirep, and any associated data
// The transaction group is how it will show as a line item
/*$expenses[] = new Expense([
'type' => ExpenseType::FLIGHT,
'amount' => 150, # $150
'transaction_group' => '',
'charge_to_user' => true|false
]);*/
return $expenses;
}
}