quote = $quote; $this->reminder_template = $reminder_template; $this->contact = $contact; } /** * Builds the correct template to send. * @return void */ public function run() { nlog($this->reminder_template); nlog("is there a template"); if (! $this->reminder_template) { $this->reminder_template = $this->quote->calculateTemplate('quote'); } $mo = new MailObject(); $this->quote->service()->markSent()->save(); $this->quote->invitations->each(function ($invitation) use ($mo) { if (! $invitation->contact->trashed() && $invitation->contact->email) { EmailEntity::dispatch($invitation, $invitation->company, $this->reminder_template); // MailEntity::dispatch($invitation, $invitation->company->db, $mo); } }); } }