Try it like this:
$pagination = (string) $users->links();
or
$pagination = $users->links()->toHtml();
Some people say that passing blank arrays to livewire and rendering them, is much faster than using objects due to serialization process. Sounds okay so far. The problem is, how would I get a pagination? I got used to this:
Livewire
//Livewire
$users = Users::where('display',true)->paginate(10)
Template
//HTML
@if($users->count())
<div class="row">
@foreach($users as $user)
<div class="col-lg-6">
{{$user->name}}
</div>
@endforeach
</div>
<div>{{$users->links()}}</div>
@endif
Is there a way to get the current html-pagination pre-rendered? Like
//Livewire
$users = Users::where('display',true)->paginate(10)
$pagination = $users->links()->render() //?!
$users = $users->toArray();
Try it like this:
$pagination = (string) $users->links();
or
$pagination = $users->links()->toHtml();
Please or to participate in this conversation.