From de55e83850387e276b1f4599a48afede9aeeb124 Mon Sep 17 00:00:00 2001 From: Harish Toshniwal Date: Tue, 28 Jan 2020 16:03:03 +0530 Subject: [PATCH] improve check for parent class --- src/FractalHelper.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/FractalHelper.php b/src/FractalHelper.php index 3a01457..269c0b5 100644 --- a/src/FractalHelper.php +++ b/src/FractalHelper.php @@ -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; /** @@ -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(); }