17 lines
485 B
PHP
17 lines
485 B
PHP
|
<?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);
|
||
|
}
|
||
|
}
|