Get total number of results with pagination

Controller

$products = ProductMaster::paginate(10); //1 page with 10 products

return view('index',compact('products'));

view

 {{ $products->total() }}   //show total products in your database

In Laravel 4 use:

{{ $users->getTotal() }}

Docs


In Laravel 5 and above use:

{{ $users->total() }}

Docs


To Get All Item Total

$paginator->total() Determine the total number of matching items in the data store. (Not available when using simplePaginate).

To Get Current Page Total

$paginator->count() Get the number of items for the current page.

Example

Controller

$users = User::paginate(10); //1 page with 10 products
return view('users', compact("users"));

View:

{{ $users->total() }} //show total users in your database