Well turns out I just solved it myself. For future reference the issue is using $this inside of the closure.
$this->to and $this->subject are references to fields on the Class and not in the Closure so to fix the code I had to make them local variables and pass them to my closure like so:
public function send()
{
$to = $this->getTo();
$subject = $this->getSubject();
return $this->mailer->queue($this->getView(), $this->getData(), function($message) use($to, $subject) {
$message->to($to)->subject($subject);
});
}
In my case was due to defining a closure function in the constructor. Took it out and it worked.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.