userMailer = $userMailer; } /** * Handle the event. * * @param InvoiceViewed $event * @return void */ public function handle(InvoiceViewed $event) { $invoice = $event->invoice; foreach ($invoice->account->users as $user) { if ($user->{'notify_viewed'}) { $this->userMailer->sendNotification($user, $invoice, 'viewed', $payment); } } } }