I'm making a chat app using laravel. There is a button in top of the chat box which if it is pressed the 30 last messages before the last previous messages in the box are loaded to the box. I know how to get 30 last messages (take methode)
from table but don't know how do it for next 30 last messages.
Can anyone help me please?
This is Message table columns:
content | from_id | to_id | created_at | users_id
------- --------- ------- ------------ ---------
hello | 39 | 12 | 7/6/2017 | 39:12
Hi i believe you can do this in laravel very easily
YourModel::paginate(30);
with this you can get data in paginated form and you dont have to use take
method