Skip to content

Commit

Permalink
ApiResponse.php changed collection parameter type from mixed to Lengt…
Browse files Browse the repository at this point in the history
…hAwarePaginator
  • Loading branch information
adrianzofcin committed Jan 18, 2023
1 parent 832c8c6 commit 2e436e1
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/Helpers/ApiResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

namespace Wame\ApiResponse\Helpers;

use Illuminate\Pagination\LengthAwarePaginator;

class ApiResponse
{
/**
Expand Down Expand Up @@ -72,11 +74,11 @@ public static function errors(mixed $errors): static
/**
* Response Data with Pagination
*
* @param mixed $pagination
* @param LengthAwarePaginator $pagination
* @param null $resource
* @return static
*/
public static function collection(mixed $pagination, $resource = null): static
public static function collection(LengthAwarePaginator $pagination, $resource = null): static
{
if ($resource) static::$data = (array)($resource::collection($pagination))->toResponse(app('request'))->getData();
else static::$data = $pagination->toArray();
Expand Down

0 comments on commit 2e436e1

Please sign in to comment.