phpvms/app/Support/Resources/CustomAnonymousResourceCollection.php

17 lines
485 B
PHP
Raw Normal View History

<?php
namespace App\Support\Resources;
use Illuminate\Http\Resources\Json\AnonymousResourceCollection;
use Illuminate\Pagination\AbstractPaginator;
class CustomAnonymousResourceCollection extends AnonymousResourceCollection
{
public function toResponse($request)
{
return $this->resource instanceof AbstractPaginator
? (new CustomPaginatedResourceResponse($this))->toResponse($request)
: parent::toResponse($request);
}
}