Support the ongoing development of Laravel.io →
Eloquent Blade

Hello,

I am trying to build a webshop in laravel 4.2. I am almost done with everything but in the last part I want to make a pagination that is showing every product of 1 head category and also the sub category products in it. So I made this script for showing the products and its returning a good array but when I use the paginator make fucntion it shows the correct number of pages in my template. The only problem is that it shows also every product in the array on each page.

This is the Function: http://laravel.io/bin/W44XE And this is the Blade code I made: http://laravel.io/bin/d99nv

Also this is how it looks now:

But it should return 9 products instead of 10 and then the 10th on the second page but now the second page is the same as the first. What am I doing wrong? I cant find the problem.. $count 3 is returning the value 10 so that is also working correct.

Last updated 3 years ago.
0

Oke I just noticed that you need to create a code to slice the array for each page.. My code now looks like this: http://laravel.io/bin/MkkwO

0

MarkMatute I use laravel 4.2 not 5.1

0

Sign in to participate in this thread!

PHPverse

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.