/**
  * Extract the data from an object.
  *
  * @param mixed $value
  *
  * @return array
  */
 protected function serializeObject($value)
 {
     if ($value instanceof \Illuminate\Database\Eloquent\Collection) {
         $items = [];
         foreach ($value as $v) {
             $items[] = $this->serializeObject($v);
         }
         return [self::MAP_TYPE => 'array', self::SCALAR_VALUE => $items];
     }
     if ($value instanceof \Illuminate\Contracts\Pagination\Paginator) {
         $items = [];
         foreach ($value->items() as $v) {
             $items[] = $this->serializeObject($v);
         }
         return [self::MAP_TYPE => 'array', self::SCALAR_VALUE => $items];
     }
     if (\is_subclass_of($value, Model::class, true)) {
         $stdClass = (object) $value->attributesToArray();
         $data = $this->serializeData($stdClass);
         $data[self::CLASS_IDENTIFIER_KEY] = \get_class($value);
         $methods = $this->getRelationshipAsPropertyName($value, get_class($value), new ReflectionClass($value));
         if (!empty($methods)) {
             $data = \array_merge($data, $methods);
         }
         return $data;
     }
     return parent::serializeObject($value);
 }
 /**
  * Extract the data from an object.
  *
  * @param mixed $value
  *
  * @return array
  */
 protected function serializeObject($value)
 {
     if ($value instanceof Collection) {
         return $this->serializeEloquentCollection($value);
     }
     if ($value instanceof Paginator) {
         return $this->serializeEloquentPaginatedResource($value);
     }
     if (\is_subclass_of($value, Model::class, true)) {
         return $this->serializeEloquentModel($value);
     }
     return parent::serializeObject($value);
 }