/**
  * 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  IncomeServiceWasCreated $event
  * @return void
  */
 public function handle(IncomeServiceWasCreated $event)
 {
     $this->incomeService->createDenominationStructure($this->buildStructure($event->incomeServiceId, $this->denomination->getActive()->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);
 }
 /**
  * Get all Services within the year or month
  *
  * @param int $year
  * @param int $month
  * @return CollectionResponse
  */
 public function getAllServices($year, $month)
 {
     $incomeServices = $this->incomeService->getAllServices($year, $month);
     return (new CollectionResponse($incomeServices))->asType('IncomeServiceList');
 }