3

I'm using Laravel Livewire and here I have 3 tables that showing on one page but the problem is the pagination showing correctly but not working(the URL change to http://127.0.0.1:8000/blogpost?EnPosts=3 but the table stays on page 1).

Livewire component class:

$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 component view:

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

these links are placed on the footer of every table.

user13708077
  • 53
  • 1
  • 7
  • 1
    "_showing correctly but not working_" What does "_not working_" mean? White page? Returning the wrong results? Links not clickable? – brombeer Oct 28 '20 at 08:28
  • the URL change like this http://127.0.0.1:8000/blogpost?EnPosts=3 but the table stays on page 1 – user13708077 Oct 28 '20 at 08:33

1 Answers1

0

May be helpful for you

$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') }}
MD Mushfirat Mohaimin
  • 1,966
  • 3
  • 10
  • 22
Faran
  • 138
  • 6