28 lines
699 B
PHP
28 lines
699 B
PHP
<?php
|
|
|
|
namespace App\Http\Resources;
|
|
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Http\Resources\Json\ResourceCollection;
|
|
|
|
class KriteriaResource extends ResourceCollection
|
|
{
|
|
/**
|
|
* Transform the resource into an array.
|
|
*
|
|
* @return array<string, mixed>
|
|
*/
|
|
public function toArray(Request $request): array
|
|
{
|
|
return [
|
|
'data' => $this->collection,
|
|
'pagination' => [
|
|
'total' => $this->total(),
|
|
'count' => $this->count(),
|
|
'per_page' => $this->perPage(),
|
|
'current_page' => $this->currentPage(),
|
|
'total_pages' => $this->lastPage()
|
|
]
|
|
];
|
|
}
|
|
} |