private function sendEmails($invoice, $type, $payment = null) { foreach ($invoice->account->users as $user) { if ($user->{"notify_{$type}"}) { $this->userMailer->sendNotification($user, $invoice, $type, $payment); } } }