How to check if $collection is odd, within the current pagination?

Posted 3 months ago by splendidkeen

I am trying to paginate(2) users within my view. And check on every pagination "side", if the number is odd, so I can display a blank field for the odd case.

So if I count 3 users, on the first pagination I would show two, and on the second 1 user and 1 space filler (because odd).

Odd logic would be

@foreach($users as $user) 
    @if(!$loop->iteration  % 2 == 0)
         
    @endif
@endforeach

But, how can I check on the current pagination, or this even possible?

Please sign in or create an account to participate in this conversation.