我被Laravel Pagination困住了 . 分页中的URL始终包含2个问号 .
http://domain.com/?direction=asc?page=2
$posts = Post::paginate(10)
->setPath(route('post-admin', [
'direction' => $direction
]))
在视图中:
{!! $post->render() !!}
我也尝试过:
{!! $post->appends([
'direction' => $direction
])->render() !!}
1 回答
试试这个:
然后在你看来:
确保不要调用
all()
方法,而是直接在模型上调用paginate()
.