阅读(2025) (0)

Laravel 8 自定义分页器 URI

2021-07-07 09:14:34 更新

withPath 方法允许你在生成分页链接时自定义 URI。例如,如果你想生成像 http://example.com/custom/url?page=N 的分页链接,你应该传递 custom/url 参数给 withPath 方法:

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

    $users->withPath('custom/url');

    //
});