2018-03-02 06:20:13 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Listeners;
|
|
|
|
|
2019-07-16 03:44:31 +08:00
|
|
|
use App\Contracts\Listener;
|
2019-07-16 03:51:35 +08:00
|
|
|
use App\Events\Expenses;
|
2021-09-30 23:10:05 +08:00
|
|
|
use App\Models\Enums\ExpenseType;
|
|
|
|
use App\Models\Expense;
|
2018-03-02 06:20:13 +08:00
|
|
|
|
2018-03-20 09:50:40 +08:00
|
|
|
class ExpenseListener extends Listener
|
2018-03-02 06:20:13 +08:00
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Return a list of additional expenses
|
2018-08-27 00:40:04 +08:00
|
|
|
*
|
2018-03-02 06:20:13 +08:00
|
|
|
* @param Expenses $event
|
2018-08-27 00:40:04 +08:00
|
|
|
*
|
2018-03-03 03:12:39 +08:00
|
|
|
* @return mixed
|
2018-03-02 06:20:13 +08:00
|
|
|
*/
|
|
|
|
public function handle(Expenses $event)
|
|
|
|
{
|
2018-03-03 03:12:39 +08:00
|
|
|
$expenses = [];
|
|
|
|
|
2018-08-27 00:40:04 +08:00
|
|
|
// 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
|
2018-03-03 03:12:39 +08:00
|
|
|
/*$expenses[] = new Expense([
|
|
|
|
'type' => ExpenseType::FLIGHT,
|
2021-09-30 23:10:05 +08:00
|
|
|
'amount' => 150, # $150
|
2018-03-06 09:55:48 +08:00
|
|
|
'transaction_group' => '',
|
2018-03-07 07:15:42 +08:00
|
|
|
'charge_to_user' => true|false
|
2018-03-03 03:12:39 +08:00
|
|
|
]);*/
|
|
|
|
|
|
|
|
return $expenses;
|
2018-03-02 06:20:13 +08:00
|
|
|
}
|
|
|
|
}
|