0

I've used the query builder instead of the normal select(I had to, I have added pagination). query builder example :

$dataGlobal = DB::table('articles')
->orderBy('articleDate', 'desc')
->orderBy('articleHour', 'desc')
->orderBy('articleMinute', 'asc')
->orderBy('articleSeconde', 'asc')
->limit(150)
->paginate(15); 

With this code, normally I shoud have 10 pages no more, but instead of the 10 pages I have 23. Counting from page 5 to 23, all of these pages aren't working with this error code; Undefined array key 0

For the pagination I'm using the bootstrap 5 blade pagination (vendor folder)

My question is why am I having all of theese pages ? The weird thing is I have this problem in one page only which is my home page, but in the other ones I don't have this problem at all everything is good

Maybe I didn't give enought details let me know if you guys need me to add something.

Ayoub
  • 3
  • 4

1 Answers1

0

Actually, you can't use limit with pagination.

see this answer: Using limit parameter in paginate function

Taha
  • 61
  • 3
  • At the beginning I wasn’t using limit. I have added it just to test that’s all. But I’ve the same problem without using limit – Ayoub Aug 28 '22 at 20:36