Get total number of results with pagination
Controller
$products = ProductMaster::paginate(10); //1 page with 10 productsreturn view('index',compact('products'));
view
{{ $products->total() }} //show total products in your database
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 productsreturn view('users', compact("users"));
View:
{{ $users->total() }} //show total users in your database