lundi 31 décembre 2018

Getting empty value of a variable in laravel mail view

I've assigned public variables in the mailable. I'm getting some values of keys but I get empty values from the keys that I had assigned later. I'm implementing queues as well.

In my controller:

public function changeOrderStatus(Order $order){

    $order->type = $request->type; //getting these two keys empty i.e.type and amount
    $order->amount = $transaction->amount;
    $mail = new CancelRefundOrder($order);

}

In my /App/Mail/CancelRefundOrder.php

class CancelRefundOrder extends Mailable implements ShouldQueue
{
    use Queueable, SerializesModels;
    public $order;
    public $order_type;

    public function __construct($order)
    {
        $this->order = $order;        
        $this->order_type = $order->type;        
    }

    public function build()
    {
        return $this->view('emails.ecommerce.cancel_refund_order_mail');
    }
}

If I dd($order_type) here I get the value. But in my blade cancel_refund_order_mail, I get empty value on or why?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire