Luthermilla Ecole
Luthermilla Ecole

Reputation: 786

How can I get the information from the array to be properly displayed (Laravel)?

Hello I have this code.

I want to send this informations from the array to the page of the email.

public function store(Request $request)
{
    $equipment=new equipment();
    $equipment -> name = request ('name');
    $equipment -> email = request ('email');
    $equipment -> department = request('department');
    $equipment -> material= request('material');
    $equipment -> finalidade = request('finalidade');
    $equipment -> till = request('till');
    $equipment -> until = request('until');
    $equipment->save();

    $data = [
        'name' => request ('name'),
        'email' => request ('email'),
        'department' => request ('department'), 
        'material' => request('material'),
        'finalidade' => request('finalidade'),
        'till' => request('till'),
        'until' => request('until')
    ];

    Mail::send('mail.newRequest',$data,function($m) use ($data){
        $m->from('[email protected]','MECTS.SA');
        $m->to('[email protected]');
        $m->subject('Requisição do colaborador '.$data['name'].' do departamento de '.$data['department']);
        $m->cc($data['email']);
    });
   
    return redirect()->route('thk');
}

This is where I create and pass the array.

Now this is the view where I want to display the data:

<td style="padding:10px;font-size:14px; width:100%;">
    <p>Nova requisição no sistema</p>
    <p>O Colaborador:$data['name']</p>
    <p><br /> Solicita: $data['material'] </p>
    <p> Por um período de:$data['till'] até:$data['untill']</p>
    <p><i>Best Regars!</i><br>
    <!-- /Callout Panel -->
    <!-- FOOTER -->
</td>

The information from the array will not be displayed (I get like O Colaborador:$data['name']), please help.

Upvotes: 1

Views: 55

Answers (1)

sergiz
sergiz

Reputation: 151

You do not do anything to actually display your passed data.

<p>O Colaborador:{{ $name }}</p>

https://laravel.com/docs/7.x/blade#displaying-data

Upvotes: 2

Related Questions