Please format your code correctly using triple backticks to wrap code snippets
Can't display the pagination links in blade file
This is livewire file:
@tykus Formatted, Please see.
die dump your links.
@shaungbhone tried that, dd() showing the pagination links but can not display on blade view.
Probably expecting an object. Just my opinion. You seem to be using an array, unless I missed something, that's a lot of code to look over.
@jlrdw ofcourse you are right, but I do not know that how to show the pagination links in blade file.
Put in collection and paginate, https://laracasts.com/discuss/channels/guides/paginate-collection-simple-example-guide
You could even make a small helper class to handle it.
@jlrdw Tried with using collection but get another error for count function on blade file, and for the helper function, I don't know how to do it. Can you show me ?
In the link, see the second example count is being dealt with.
@jlrdw Tried but can not get the actual point, can you show me example in my code?
I am just using slice, if you want to use array you can use array_slice, https://www.php.net/manual/en/function.array-slice.php
Only look at the example where the length aware paginator is. The other code was for showing a special display. Slice is easy.
Edit: another example https://laracasts.com/discuss/channels/laravel/paginate-collection-1
Also why not just paginate $faxStatusData?
You cannot convert the data to an array and then expect pagination links to survive
$this->faxStatus = $faxStatusData->orderByDesc('id')->paginate(5)->toArray();
Why convert to an array?
Because he got a PublicPropertyTypeNotAllowedException for trying to set the paginate to a public Livewire variable.
@rjrocks do this...
// public $faxStatus = []; remove this
public function faxData()
{
$faxStatusData = FaxOutgoing::where('sent_status', $this->status)
->whereNull('archive_by');
// .... all your other code here. that's a different discussion.
return $faxStatusData->orderByDesc('id')->paginate(5);
// count fax
//
// remove all this if it's the same as the query above.
}
public function render()
{
$faxdataPaginate = $this->faxData();
return view('livewire.fax-queue-status',[
'faxStatus' => $faxdataPaginate,
'faxCount' => $faxdataPaginate->total(), // here is the total of all the records from paginate
]);
}
Now you're going to have to fix your view...
Please or to participate in this conversation.