skip to Main Content

SOLVED. My nginx configuration was wrong and now it is fixed.

I have code like this in controller:

$MyItems = AppModelsMyItems::paginate(10);

On URL https://example.com/my-item it will execute SQL:

array:2 [▼
  0 => array:3 [▶]
  1 => array:3 [▼
    "query" => "select * from `teams` order by `name` asc limit 10 offset 0"
    "bindings" => []
    "time" => 0.33
  ]
]

On URL https://example.com/my-item?page=3 it will be the same SQL and the same data in respond. For some reason offset is always "0". Where did I turn wrong?

2

Answers


  1. Since AppModelsMyItems is a class, it should be using scope resolution ::

    $MyItems = AppModelsMyItems::paginate(10);
    

    When the left part is an object instance, you use ->. Otherwise, you use ::

    Login or Signup to reply.
  2. The code should be like this

    $MyItems = AppModelsMyItems::paginate(10);
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search