Luis Lopez
Luis Lopez

Reputation: 1287

Forelse loop inside a <div> tag

I'm trying to make a container with a list of images and attributes, but when I add a tag around the array, the array simply go outside my container, I had searched this type of question but didn't find it.

This is the code:

@if(count($elitePublications) > 0)
<div style="border:2px gold solid">
    @forelse($elitePublications as $key => $publication)
        @include('publications.small', compact('publication'))
    @empty
        <p></p>
    @endforelse
</div>
@endif

It only make the container but the list is outside

The code of publications.small:

<div class="col-sm-4 book">
<a href="{{ route('users.publications.show', ['publications'=>$publication->id, 'users'=>$publication->user->username]) }}"> 
    <div class="book-cover">
        {{ $publication->image }}
        <div class="inner-book-content">
            <h4>{{ $publication->published_book_title }}</h4>
             <strong class="book-price">
            </strong>
        </div>
    </div>
</a>
</div>

Thanks in advance.

Upvotes: 0

Views: 217

Answers (1)

Luis Lopez
Luis Lopez

Reputation: 1287

The issue here is about Bootstrap. Some kind of problem with the columns and the rows (who guest the results), so I just added a class in my div called "row" it act as a container for my array.

Like:

<div class="row">
    <h4 style="font-style: italic;"> Recomendados </h4>
    @forelse($elitePublications as $key => $publication)
        @include('publications.small', compact('publication'))
    @empty
    @endforelse
</div>

Upvotes: 1

Related Questions