I'm getting data through an API and this is what i get. Can I still paginate this array? If so how?
This is an array which comes directly from a database query which works.
Illuminate\Pagination\LengthAwarePaginator Object
(
[total:protected] => 14
[lastPage:protected] => 3
[perPage:protected] => 5
[currentPage:protected] => 1
[path:protected] => http://localhost/laravel.dev/index.php/positions/testing
[fragment:protected] =>
[pageName:protected] => page
[query:protected] => Array
(
)
[items:protected] => Illuminate\Support\Collection Object
(
[items:protected] => Array
(
[0] => stdClass Object
(
[id] => 1
[company_id] => 1
[title] => Software Developer
)
[1] => stdClass Object
(
[id] => 2
[company_id] => 2
[title] => Accountant
)
[2] => stdClass Object
(
[id] => 3
[company_id] => 3
[title] => Insurance salesman
)
[3] => stdClass Object
(
[id] => 4
[company_id] => 3
[title] => System administratori
)
[4] => stdClass Object
(
[id] => 5
[company_id] => 2
[title] => Stock Trader
)
)
)
)
And this is encoded and decoded Json:
Array
(
[total] => 14
[per_page] => 5
[current_page] => 1
[last_page] => 3
[next_page_url] => http://localhost/laravel.dev/index.php/positions?page=2
[prev_page_url] =>
[from] => 1
[to] => 5
[data] => Array
(
[0] => Array
(
[id] => 1
[company_id] => 1
[title] => Software Developer
)
[1] => Array
(
[id] => 2
[company_id] => 2
[title] => Accountant
)
[2] => Array
(
[id] => 3
[company_id] => 3
[title] => Insurance salesman
)
[3] => Array
(
[id] => 4
[company_id] => 3
[title] => System administratori
)
[4] => Array
(
[id] => 5
[company_id] => 2
[title] => Stock Trader
)
)
)
This is the code that spits out the Pagination links
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1rQ9Ved
via IFTTT
Aucun commentaire:
Enregistrer un commentaire