Thursday, March 2, 2017

Pagination data division

What I am trying to accomplish is something like this say Users::paginate(26)

now in my view

it should be displayed like this

user-1, user 2

newline then i will chunk it to 4

user-3, user-4, user-5, user-6 -- row 1

user-7, user-8,user-9,user-10 -- row 2

etc..

I am done with the chunk part, the only thing i am having a hard time is getting the first two then chunk the 3rd data until the last

i am not sure how to accomplish that since

$users->chunk(4)` //only divide it by 4

I also tried

$users_top = Users::get();
$user_bottom = Users::whereNotIn['id', $top[0]->id, $top[1]->id]->get();

but it seems there is a much more simpler logic than that




via AkoSi Asiong

Advertisement