1 | <?php |
||
15 | class EloquentProcessingService extends AbstractProcessingService |
||
16 | { |
||
17 | /** |
||
18 | * @param Builder|EloquentBuilder $data |
||
19 | * @return Traversable |
||
20 | */ |
||
21 | 14 | protected function afterOperations($data) |
|
22 | { |
||
23 | 14 | if ($data instanceof EloquentBuilder) { |
|
24 | 14 | return $data->get(); |
|
25 | 1 | } elseif ($data instanceof Builder) { |
|
26 | 1 | return new ArrayIterator($data->get()); |
|
27 | } |
||
28 | throw new RuntimeException('Unsupported type of data source.'); |
||
29 | } |
||
30 | |||
31 | /** |
||
32 | * @param Builder|EloquentBuilder $data |
||
33 | * @return Builder|EloquentBuilder |
||
34 | */ |
||
35 | 21 | protected function beforeOperations($data) |
|
39 | |||
40 | /** |
||
41 | * @return int |
||
42 | */ |
||
43 | 7 | public function count() |
|
49 | } |
||
50 |