Multiple images in public view using media module
I'm trying to get multiple images on a public view. ( the backend works fine on my module)
I am able to get 1 image there but mutiple images fails. I followed the tutorial on
At the last part of the tutorial this is explained very quickly. I saw that I had to add a function in my entity like this:
public function getGalleryAttribute()
However I never saw it getting called in the publicController. So I think that there is a problem but I'm not sure. Also in the public view I had to add somthing like this:
@foreach($carousels->gallery as $carousel)
But that gives me a error Undefined property: Illuminate\Database\Eloquent\Collection::$gallery
I hope someone can put me in the right direction for this as I want to build a carousel.
Thanks in advance
Ok solved it myself. I've made a stupit mistake. I forgot to add a second foreach. So for anyone interested, this is how my new code looks in the public view.
@foreach($carousels as $carousel)
@foreach($carousel->carousel as $img)