How to pass data to mail View in laravel Mail send

0 votes

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

Here's my controller's send mail 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 emails.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>&nbsp;www.mydomain.com/login</p>
Jul 30, 2020 in Laravel by kartik
• 37,520 points
7,907 views

1 answer to this question.

0 votes

Hello @kartik,

Send data like this.

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

You can access it directly as $data and $password in email blade

Hope it helps!!
Thank you!

answered Jul 30, 2020 by Niroj
• 82,840 points

Related Questions In Laravel

0 votes
1 answer

How to get view data during unit testing in Laravel?

Hii, Try this: $response->getSession()->get("errors") And from there you can check ...READ MORE

answered Nov 2, 2020 in Laravel by Niroj
• 82,840 points
2,148 views
0 votes
1 answer

How to pass URL param in Laravel?

Hello, First you have to go to routes ...READ MORE

answered Mar 18, 2020 in Laravel by Niroj
• 82,840 points
5,193 views
0 votes
1 answer

Explain validations in laravel and How to validate my application incoming data?

Hey @kartik, In Programming validations are a handy ...READ MORE

answered Mar 23, 2020 in Laravel by Niroj
• 82,840 points
1,437 views
0 votes
1 answer

How to pass CSRF token with ajax request in Laravel?

Hey, In between head, tag put <meta name="csrf-token" ...READ MORE

answered Mar 24, 2020 in Laravel by Dey
39,803 views
+1 vote
1 answer

How to make anchor tag with routing using Laravel?

Hey @kartik, First you have to go to ...READ MORE

answered Mar 18, 2020 in Laravel by Niroj
• 82,840 points
23,021 views
0 votes
1 answer

What is redirection in Laravel?

Named route is used to give specific ...READ MORE

answered Mar 18, 2020 in Laravel by Niroj
• 82,840 points
3,000 views
0 votes
1 answer

How to install Laravel via composer?

Hello, This is simple you just need to ...READ MORE

answered Mar 23, 2020 in Laravel by Niroj
• 82,840 points
2,922 views
+1 vote
1 answer

What are named routes in Laravel and How can specify route names for controller actions?

Hey @kartik, Named routing is another amazing feature of ...READ MORE

answered Mar 23, 2020 in Laravel by Niroj
• 82,840 points
44,765 views
0 votes
1 answer

How to pass data to view in Laravel?

Hello @kartik, You can pass data to the ...READ MORE

answered Sep 11, 2020 in Laravel by Niroj
• 82,840 points
706 views
0 votes
1 answer

How to pass data through URL and access through controller in Laravel?

Hello, You can  first refer how to  Create controller through ...READ MORE

answered Mar 18, 2020 in Laravel by Niroj
• 82,840 points
11,904 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP