Level 75
Sep 20, 2018
5
Level 1
Pagination of data from a relation
$galeriaInfo = Galeria::where('slug', 'LIKE', $slug)
->with(['multimedia'])
->withCount('multimedia')
->paginate(15);
Printing this $galeriaInfo I see the correct information on the screen ... info of the specific gallery and 15 images retrived from the other model. But how can I access the info on the blade template?
Doing
<h1>Galeria<span class="verde">{{ $galeriaInfo->nome }}</span></h1>
Gives: Undefined property: Illuminate\Pagination\LengthAwarePaginator::$nome
Level 24
You have to use a loop:
@foreach($galeriaInfo as $galeria)
{{ $galeria->nome }}
@endforeach
Please or to participate in this conversation.