/** * Handle the event. * * @param IncomeServiceWasCreated $event * @return void */ public function handle(IncomeServiceWasCreated $event) { $incomeService = $this->incomeService->show($event->incomeServiceId); foreach ($incomeService->fund_structure as $fundStructure) { $this->incomeService->createFundItemStructure($this->buildStructure($event->incomeServiceId, $fundStructure->id, $this->getActive($fundStructure->item->toArray()))); } }
/** * Handle the event. * * @param IncomeServiceMemberFundWasUpdated $event * @return void */ public function handle(IncomeServiceMemberFundWasUpdated $event) { $payload = ['tithes' => $event->tithes, 'offering' => $event->offering, 'other_fund' => $event->others, 'total' => $event->total]; $this->incomeService->updateFunds($event->incomeServiceId, $payload); return $this->incomeService->show($event->incomeServiceId); }
/** * Display a certain Income Service * * @param int $id * @return ItemResponse */ public function show($id) { $incomeService = $this->incomeService->show($id); return (new ItemResponse($incomeService))->asType('IncomeService'); }