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.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community