Lars-Janssen's avatar

Laravel pagination info

Hello,

How do I get the following info with my json response:

current_page: 1,
from:1,

last_page:1,

next_page_url:null,

per_page:5,

prev_page_url:null,
to:5,
total:5


I use pagination like this:

$rides = $user->rides()
            ->with('user', 'location', 'type')
            ->paginate(1);  

It should be set by default. (https://laravel.com/docs/5.1/pagination)

(I am using vue.js)

Thankyou

0 likes
5 replies
Lars-Janssen's avatar

@maxnb

Not working anymore.

For example:

$rides->getTotal();

Method getTotal does not exist.

nikocraft's avatar

try $rides->total(); I just tested it it worked for me

Please or to participate in this conversation.