* Souhrnný formát výstupu pro paginovaná data s metadaty. * * @OA\Schema( * schema="PaginableResourceMeta", * type="object", * title="Paginable Resource (meta)", * description="A paginated collection with meta information", * @OA\Property(property="totalCount", type="integer", example=1), * @OA\Property(property="pages", type="integer", example=10), * ) */ class PaginableResource extends JsonResource { public function __construct(mixed $resource, protected readonly string $classResource) { parent::__construct($resource); } /** * Transform the resource collection into an array. * * @return array */ public function toArray(Request $request): array { return [ 'items' => $this->classResource::make($this->data), 'meta' => [ 'totalCount' => $this->totalCount, 'pages' => $this->totalPages, ] ]; } }