0

So I don't understand how to pass variable to my layout.

Actually i'm using

    Mail::send('emails.aLaCarteMail', $data, function($message) use ($user) {
        $message->from('wtv@wtv.com', 'Agence de Voyage');
        $message->to($user['email'], $user['name'])->subject('Demande : Voyage à la carte ['.$user['email'].']');
        return "true";
    });

$data being an array like :

    $data = array(
        'prenom'=> $prenom,
        'nom'=> $nom,
        'email'=> $email,
         ...
    );

So my mail is sent with the right template but without the variable like {{$prenom}} or {{$email}} which are let as blank.

Can someone highlight me what am I missing ?

Baldráni
  • 5,332
  • 7
  • 51
  • 79
  • it should be {{ $data['prenom'] }} – madankundu Sep 28 '16 at 09:19
  • @madankundu nop, error 500 with log being -> `Undefined variable: data ...` – Baldráni Sep 28 '16 at 09:36
  • Uhm... Should work as it is.. Make sure `$data` is a key pair array as you present it and try to remove the `return "true";` (it should matter, but I would give that a shot). Also, try to use a direct array instead of data (ex `['something' => '123']` and `dd($something)` on the view, to make sure it works with static data. – Luís Cruz Sep 28 '16 at 21:49
  • 1
    @milz I solved It Thank you. A bit of discussion on the chat highlight me. I'll colsed the thread It worked as it was indeed the problem came from serializedData sent. – Baldráni Sep 28 '16 at 21:54

0 Answers0