Note that there are some explanatory texts on larger screens.

plurals
  1. POHow do we correctly send data to Mail::queue()?
    primarykey
    data
    text
    <p>I'm trying to Mail::queue() and this is what I'm doing:</p> <p>This is the class that sends my e-mails</p> <pre><code>class Email { public static function send($user, $view, $subject) { Mail::queue($view, array('user' =&gt; $user), function($m) use ($user, $subject) { $m-&gt;to($user-&gt;email)-&gt;subject($subject); }); Log::info("Mail [$subject] sent to $user-&gt;email"); } } </code></pre> <p>This is the guy who calls marshal()</p> <pre><code>class QueueController extends BaseController { public function push() { Log::info('[queue.push] Queue::marshal() called'); return Queue::marshal(); } } </code></pre> <p>This is how I'm calling it:</p> <pre><code>Email::send($user, 'site.users.emailRegistered', 'Activate your account'); </code></pre> <p>And this is the view that I'm trying to render as an email message:</p> <pre><code>&lt;!DOCTYPE html&gt; &lt;html lang="en-US"&gt; &lt;head&gt;&lt;meta charset="utf-8"&gt;&lt;/head&gt; &lt;body&gt; &lt;h2&gt;Hi,&lt;/h2&gt; &lt;div&gt; Please, click the link to activate your account: {{ URL::route('activate', array($user-&gt;id,$user-&gt;getActivationCode())) }} &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>The problem is that Mail::send() works fine but when I use Mail::queue() and marshal() is fired I get a bunch of errors lines in log related to "Trying to get property of non-object".</p> <p>Obviously my data is not being serialized correctly, because I'm passing some instantiated model to it, but how I serialize it correctly?</p> <p>I already tried to create a $data array and put everything on it and then pass just it to Mail::queue(), with no luck.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload