How to access protected lastPage property from result set

Tuesday, November 3, 2015

I am using laravel 4.2 and for some reason i need to access the lastPage property in my view which I failed. Here is the code of my controller when paginating.



$products = Product::where('status', '=', 'available')->paginate(20);


Below is a part of var_dump($products) in my view file and i need to know how to access it the correct way.



  protected 'total' => int 10491
protected 'hasMore' => null
protected 'perPage' => int 20
protected 'currentPage' => int 1
protected 'lastPage' => int 525
protected 'from' => int 1
protected 'to' => int 20

0 comments:

Post a Comment