gpt4 book ai didi

Laravel Livewire 一页多页

转载 作者:行者123 更新时间:2023-12-05 06:58:37 25 4
gpt4 key购买 nike

我正在使用 Laravel Livewire,这里我有 3 个表格显示在一页上,但问题是分页显示正确但不起作用(URL 更改为 http://127.0.0.1:8000/blogpost?EnPosts=3 但表格保留在第 1 页)。

Livewire 组件类:

$En = LangBlog::where('id', '1')->first();
$Fa = LangBlog::where('id', '2')->first();
$Pa = LangBlog::where('id', '3')->first();

return view('livewire.admin.blogs', [
'EnPosts' => $En->blogPosts()->paginate(1, ['*'], 'EnPosts'),
'FaPosts' => $Fa->blogPosts()->paginate(1, ['*'], 'FaPosts'),
'PaPosts' => $Pa->blogPosts()->paginate(1, ['*'], 'PaPosts'),
])->layout('layouts.master');

Livewire 组件 View :

{{ $EnPosts->links('pagination.custom-pagination') }}
{{ $FaPosts->links('pagination.custom-pagination') }}
{{ $PaPosts->links('pagination.custom-pagination') }}

这些链接位于每个表格的页脚。

最佳答案

可能对你有帮助

$En = LangBlog::where('id', '1')->paginate(10); $Fa = LangBlog::where('id', '2')->paginate(10); $Pa = LangBlog::where('id', '3')->paginate(10);

return view('livewire.admin.blogs', [EnPosts' => $En,'FaPosts'=>$Fa,'PaPosts'=>$Pa]); in Component View {{ $EnPosts->links('pagination.custom-pagination') }} {{ $FaPosts->links('pagination.custom-pagination') }} {{ $PaPosts->links('pagination.custom-pagination') }}

关于Laravel Livewire 一页多页,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64568979/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com