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

Send data like this.

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

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


$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"] }}

The callback argument can be used to further configure the mail. Checkout the following example:

Mail::send('emails.dept_manager_strategic-objectives', ['email' => $email], function ($m) use ($user) {
        $m->from('[email protected]', 'BusinessPluse');
        $m->to($user, 'admin')->subject('Your Reminder!');
});