mardi 19 février 2019

How can i define the $to variable in Mail function of Laravel

Hi I do not know where the problem is because the variable is defined but laravel says that it's not my code is:

$to = $request->input('mail_contacto');
$razon_social = $request->input('razon_social');
$password = str_random(15);
$data = ['password' => $password];

Mail::send('email.email', $data, function($message)
{
    $message->to($to, $razon_social)->subject('Welcome!');
});

It says this error:

ErrorException in ClientesController.php line 134: Undefined variable: to

But the variable is defined and it's not empty because i checked it.

What can it be? Thanks.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire