mercredi 31 mai 2017

Displaying A Laravel Collection in a blade template

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.



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2rm8kxm
via IFTTT

Aucun commentaire:

Enregistrer un commentaire