company = $company; $this->user = $user; $this->payment = $payment; $this->settings = $payment->client->getMergedSettings(); } /** * Execute the job. * * @return void */ public function handle() { /*If we are migrating data we don't want to fire these notification*/ if ($this->company->is_disabled) return true; //Set DB MultiDB::setDb($this->company->db); //if we need to set an email driver do it now $this->setMailDriver(); try { $mail_obj = (new EntityPaidObject($this->payment))->build(); $mail_obj->from = [$this->user->email, $this->user->present()->name()]; //send email Mail::to($this->user->email) ->send(new EntityNotificationMailer($mail_obj)); } catch (Swift_TransportException $e) { $this->failed($e->getMessage()); //$this->entityEmailFailed($e->getMessage()); } if (count(Mail::failures()) > 0) { $this->logMailError(Mail::failures(), $this->payment->client); } else { // $this->entityEmailSucceeded(); } } }