I'm having issues displaying a collection in a blade template.
$comments = Comment::all();
return view('comments/index')->with(compact('comments'));
The code for the blade is:
@isset($comments)
@foreach($comments as $comment)
<div>
<p>
<a href=""><</a>
</p>
</div>
<hr>
@endforeach
@endisset
@empty($comments)
<div>
<p>There were no comments available.</p>
@endempty
But not sure how to get the data to render in the template. It just renders a blankpage.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire