I'm currently using Laravel 5.6 and I have a result from an api. I'm trying to paginate the results and I'm not able to do it.
My json result is like this:
{#922 ▼
+"orders": array:50 [▼
0 => {#220 ▶}
1 => {#234 ▶}
2 => {#250 ▶}
3 => {#263 ▶}
4 => {#274 ▶}
5 => {#297 ▶}
6 => {#310 ▶}
7 => {#322 ▶}
8 => {#338 ▶}
9 => {#351 ▶}
]
}
I then get orders and put into a variable like so: $orders = $call->orders;
I have attempted this:
$orders = $shopifyData->paginate(20)->toArray();
I get this error: Call to a member function paginate() on array
I have also attempted this: $orders::Paginate(20);
Also doesn't work.
I think I'm missing the first step to how to do this but honestly I'm lost. I'm not really sure how to go about it. Googling has several examples on how to do it when you are using an Eloquent model to retrieve the data from a database. It also shows how to do it when you query a database but nothing. The laravel documentation found under 5.6 pagination: Paginating Query Builder Results Paginating Eloquent Results
Manually Creating A Paginator is very limited and only says to use paginator or lengthAwarePginator and to use array_slice.
Can someone point me in the right direction of how to achieve this?
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2HHkxbc
via IFTTT
Aucun commentaire:
Enregistrer un commentaire