dimanche 25 octobre 2015

laravel 5.1 database queue not working

I'm trying to use database driver for queuing emails. Using Mail::send emails are sent as expected. But when I use Mail::queue the user object passed to the view gets null "Trying to get property of non-object".

I have a mailer class and these are the methods responsible for sending the email:

 public function sendAssignmentEmail(User $user)
    {
        $this->to=$translator->email;
        $this->view='emails.assigned';
        $this->data=compact('user');
        $this->subject='subject';
        $this->deliver();
    }

public function deliver()
    {
        $to=$this->to;
        $subject=$this->subject;
        $from=$this->from;
        return $this->mailer->queue($this->view,$this->data, function($message)
        use($to, $subject, $from)
        {
            $message->from($from, 'example.com');
            $message->to($to);
            $message->subject($subject);
        });
    }

What am I doing wrong?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire