@@ 42-49 (lines=8) @@ | ||
39 | */ |
|
40 | protected function serializeObject($value) |
|
41 | { |
|
42 | if ($value instanceof \Illuminate\Database\Eloquent\Collection) { |
|
43 | $items = []; |
|
44 | foreach ($value as &$v) { |
|
45 | $items[] = $this->serializeObject($v); |
|
46 | } |
|
47 | ||
48 | return [self::MAP_TYPE => 'array', self::SCALAR_VALUE => $items]; |
|
49 | } |
|
50 | ||
51 | if ($value instanceof \Illuminate\Contracts\Pagination\Paginator) { |
|
52 | $items = []; |
|
@@ 51-58 (lines=8) @@ | ||
48 | return [self::MAP_TYPE => 'array', self::SCALAR_VALUE => $items]; |
|
49 | } |
|
50 | ||
51 | if ($value instanceof \Illuminate\Contracts\Pagination\Paginator) { |
|
52 | $items = []; |
|
53 | foreach ($value->items() as &$v) { |
|
54 | $items[] = $this->serializeObject($v); |
|
55 | } |
|
56 | ||
57 | return [self::MAP_TYPE => 'array', self::SCALAR_VALUE => $items]; |
|
58 | } |
|
59 | ||
60 | if (is_subclass_of($value, Model::class, true)) { |
|
61 |