financeSvc = $financeSvc; } /** * @param $events */ public function subscribe(Dispatcher $events): void { $events->listen( PirepAccepted::class, 'App\Listeners\FinanceEvents@onPirepAccept' ); $events->listen( PirepRejected::class, 'App\Listeners\FinanceEvents@onPirepReject' ); } /** * Kick off the finance events when a PIREP is accepted * @param PirepAccepted $event * @throws \UnexpectedValueException * @throws \InvalidArgumentException * @throws \Exception * @throws \Prettus\Validator\Exceptions\ValidatorException */ public function onPirepAccept(PirepAccepted $event): void { $this->financeSvc->processFinancesForPirep($event->pirep); } /** * Delete all finances in the journal for a given PIREP * @param PirepRejected $event * @throws \UnexpectedValueException * @throws \InvalidArgumentException * @throws \Exception */ public function onPirepReject(PirepRejected $event): void { $this->financeSvc->deleteFinancesForPirep($event->pirep); } }