phpvms/app/Support/Resources/CustomPaginatedResourceResponse.php
Nabeel S 12848091a2
Laravel 9 Update (#1413)
Update to Laravel 9 and PHP 8+

Co-authored-by: B.Fatih KOZ <fatih.koz@gmail.com>
2022-03-14 11:45:18 -04:00

37 lines
816 B
PHP

<?php
namespace App\Support\Resources;
use Illuminate\Http\Resources\Json\PaginatedResourceResponse;
use Illuminate\Support\Arr;
class CustomPaginatedResourceResponse extends PaginatedResourceResponse
{
protected function paginationLinks($paginated)
{
return [
'first' => null,
'last' => null,
'prev' => null,
'next' => null,
];
}
protected function meta($paginated)
{
$arr = Arr::except($paginated, [
'data',
'first_page_url',
'last_page_url',
'prev_page_url',
'next_page_url',
'links',
]);
$arr['prev_page'] = $paginated['prev_page_url'];
$arr['next_page'] = $paginated['next_page_url'];
return $arr;
}
}