| Conditions | 2 |
| Paths | 2 |
| Total Lines | 16 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 54 | public function execute() |
||
| 55 | { |
||
| 56 | $attributes = $this->builder() |
||
| 57 | ->distinct() |
||
| 58 | ->get($this->attribute) |
||
| 59 | ->shuffle() |
||
| 60 | ->take($this->take) |
||
| 61 | ->pluck($this->attribute); |
||
| 62 | |||
| 63 | // Return a single attribute |
||
| 64 | if ($attributes->count() == 1) { |
||
| 65 | return $attributes->first(); |
||
| 66 | } |
||
| 67 | // Return an array of attributes if more than '1' is being taken |
||
| 68 | else { |
||
| 69 | return $attributes->toArray(); |
||
| 70 | } |
||
| 73 |