Laravel - Pagination - Customizing Pagination Urls

By default, links generated by the paginator will match the current request's URI. However, the paginator's withPath method allows you to customize the URI used by the paginator when generating links. For example, if you want the paginator to generate links like, you should pass /admin/users to the withPath method:

    use App\Models\User;
    Route::get('/users', function () {
        $users = User::paginate(15);