lundi 18 février 2019

How to pass data to mail view using queue?

I have my job class ProductPublish method handle() I am trying to send email.

public function handle()
{
   //
    Mail::to('i******o@gmail.com')->send(new SendEmail());
}

In the ProductController controller I am calling that job class as like below

ProductPublish::dispatch();

In the SendEmail class which is mailable I am trying to pass data to view as like below

public $message;
public function __construct($message)
{
    $this->message = 'This is test message';
}
public function build()
{
    return $this->view('email.product.product-publish')->with('message' => $this->message); 
} 

But it does not works. I also tried with no attaching with() method but still does getting result. In the email view I am calling data as like below



Can someone kindly guide me what can be issue that it is not working. Also I want to pass data actually from ProductController but since I am failed to pass from sendEmail that's I didn't tried yet from controller.

Kindly guide me how can I fix it.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire