Conditions | 1 |
Paths | 1 |
Total Lines | 13 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
16 | protected function modelsProvider(string $modelClass, int $limit = null): array |
||
17 | { |
||
18 | $this->refreshApplication(); |
||
|
|||
19 | |||
20 | return $modelClass::query() |
||
21 | ->get() |
||
22 | ->when(isset($limit), function (Collection $collection) use ($limit) { |
||
23 | return $collection->shuffle()->take($limit); |
||
24 | }) |
||
25 | ->map(function ($model) { |
||
26 | return [$model]; |
||
27 | }) |
||
28 | ->toArray(); |
||
29 | } |
||
31 |