Skip to content

Commit

Permalink
improve check for parent class
Browse files Browse the repository at this point in the history
  • Loading branch information
introwit committed Jan 28, 2020
1 parent c4ab9ad commit de55e83
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/FractalHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,14 @@

namespace EventHomes\Api;

use EventHomes\Api\ApiController;
use League\Fractal\Manager;
use League\Fractal\Pagination\IlluminatePaginatorAdapter;
use League\Fractal\Resource\Collection;
use League\Fractal\Resource\Item;
use League\Fractal\Manager;
use League\Fractal\Serializer\ArraySerializer;

trait FractalHelper
{

use ApiController;

/**
Expand Down Expand Up @@ -106,7 +104,9 @@ protected function respondWithCollection($collection, $transformer, $key = null)
{
$paginator = null;

if (get_class($collection) !== 'Illuminate\Database\Eloquent\Collection') {
$collectionClass = 'Illuminate\Support\Collection';

if (!($collection instanceof $collectionClass)) {
$paginator = new IlluminatePaginatorAdapter($collection);
$collection = $collection->getCollection();
}
Expand Down

0 comments on commit de55e83

Please sign in to comment.