Laravel - Pagination - Paginating Eloquent Results

You may also paginate Eloquent queries. In this example, we will paginate the App\Models\User model and indicate that we plan to display 15 records per page. As you can see, the syntax is nearly identical to paginating query builder results:

    use App\Models\User;
    $users = User::paginate(15);

Of course, you may call the paginate method after setting other constraints on the query, such as where clauses:

    $users = User::where('votes', '>', 100)->paginate(15);

You may also use the simplePaginate method when paginating Eloquent models:

    $users = User::where('votes', '>', 100)->simplePaginate(15);

Similarly, you may use the cursorPaginate method to cursor paginate Eloquent models:

    $users = User::where('votes', '>', 100)->cursorPaginate(15);