Laravel Mail::send how to pass data to mail View

后端 未结 4 889
迷失自我
迷失自我 2020-12-31 21:15

How can i pass data from my Controller to my customized mail View ?

Here\'s my controller\'s send mail method :

4条回答
  •  生来不讨喜
    2020-12-31 22:20

    $data = [
           'data' => $user->pidm,
           'password' => $user->password
    ];
    

    second argument of send method passes array $data to view page

    Mail::send('emails.auth.registration',["data1"=>$data] , function($message)
    

    Now, in your view page use can use $data as

    User name : {{ $data1["data"] }}
    password : {{ $data1["password"] }}
    

提交回复
热议问题