I have a Laravel aplication, with standard Authentication implemented. I would like to get the paginated list of the users in a table, but I get this error:
BadMethodCallException in Macroable.php line 81: Method paginate does not exist.
Here is the code:
$users = User::all()->paginate(25);
If I use this without calling the paginate() method, everything works well. Am I doing something wrong? I searched a lot, but I cannot find the answer.
Try this code:
$users = User::paginate(25);
The thing is paginate() is kind of doing get() for you. And all() does it too.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With