Ok so I have setup a table to manage two different tables (images and videos). So I'm trying to show a list of content like a feed. But each table has a different style. Now I managed to pull through relationships each table. But displaying them has been my problem.
$content = Content::orderBy('updated_at')
->with('usersVideos','usersVideos', 'usersImages')->get();
now in the blade when I try to display it using this I only get one table.
@foreach($activities as $a => $activity)
this is for pulling from the image table
@if($activity->usersImages)
@foreach($activity->usersImages as $image)
//display image
@endforeach
@elseif($activity->usersVideos)
@foreach($activity->usersVideos)
//display videos
@endforeach@endif
Not sure if there is a better way to pull from the tables into the same feed. Any suggestions
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2uAK52u
via IFTTT
Aucun commentaire:
Enregistrer un commentaire