Support the ongoing development of Laravel.io →
posted 5 years ago
Last updated 1 year ago.
0

Hi Pooja,

Seems like a pretty straight forward situation?

// controller
public method index()
{
    $data = array([
        'name' => 'John',
        'email' => '[email protected]',
    ],[
        'name' => 'John',
        'email' => '[email protected]',
    ]);

    return view('index')->with('data', $data);
}
// blade file
<table>
  <tr>
    <td>Name</td>
    <td>Email</td>
  </tr>

@foreach ($data as $person)
  <tr>
    <td>{{ $person['name'] }}</td>
    <td>{{ $person['email'] }}</td>
  </tr>
@endforeach

</table>

Obviously, the array can be filled with anything (often some database results) and you'll need to change the table to your needs, but this is basically it.

0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.