| Conditions | 1 |
| Paths | 1 |
| Total Lines | 9 |
| Code Lines | 5 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 7 |
| CRAP Score | 1 |
| Changes | 4 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 23 | 1 | public function generateCoupons(int $times = 5, int $length = 7, array $attributes = []): Collection |
|
| 24 | { |
||
| 25 | 1 | return Collection::times($times, function () use ($length, $attributes) { |
|
| 26 | 1 | $fields = collect([ |
|
|
|
|||
| 27 | 1 | $this->model->getCodeColumn() => Str::random($length), |
|
| 28 | 1 | $this->model->getTypeColumn() => CouponContract::TYPE_PERCENTAGE, |
|
| 29 | 1 | ]); |
|
| 30 | |||
| 31 | 1 | $this->model->create($fields->merge($attributes)->toArray()); |
|
| 32 | 1 | }); |
|
| 56 |