Laravel - Pagination - Simple Pagination
paginate method counts the total number of records matched by the query before retrieving the records from the database. This is done so that the paginator knows how many pages of records there are in total. However, if you do not plan to show the total number of pages in your application's UI then the record count query is unnecessary.
Therefore, if you only need to display simple "Next" and "Previous" links in your application's UI, you may use the
simplePaginate method to perform a single, efficient query:
$users = DB::table('users')->simplePaginate(15);