Laravel Mail :: send, how to send data to mail View
How can I transfer data from my Controller to my configured View mail ?
Here's my controller dispatches the post method:
$data = array($user->pidm, $user->password);
Mail::send('emails.auth.registration', $data , function($message){
$message->to(Input::get('Email'), 'itsFromMe')
->subject('thisIsMySucject');
Here's my email addresses .auth.registration View
<p>You can login into our system by using login code and password :</p>
<p><b>Your Login Code :</b></p> <!-- I want to put $data value here !-->
<p><b>Your Password :</b></p> <!--I want to put $password value here !-->
<p><b>Click here to login :</b> www.mydomain.com/login</p>
Thanks in advance.
+7
source to share
3 answers
$data = [
'data' => $user->pidm,
'password' => $user->password
];
the second argument of the send method passes the $ data array to view the page
Mail::send('emails.auth.registration',["data1"=>$data] , function($message)
Now in your pageview page you can use $ data like
User name : {{ $data1["data"] }}
password : {{ $data1["password"] }}
+13
source to share
The callback argument can be used to further customize the mail. Checkout using the following example:
Mail::send('emails.dept_manager_strategic-objectives', ['email' => $email], function ($m) use ($user) {
$m->from('info@primapluse.com', 'BusinessPluse');
$m->to($user, 'admin')->subject('Your Reminder!');
});
0
source to share