| Conditions | 1 |
| Paths | 1 |
| Total Lines | 9 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 7 |
| CRAP Score | 1 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 38 | 1 | public function generateCouponFor(Model $redeemer, string $code, array $attributes = []): CouponContract |
|
| 39 | { |
||
| 40 | 1 | $fields = collect([ |
|
| 41 | 1 | $this->model->getCodeColumn() => $code, |
|
| 42 | 1 | $this->model->getRedeemerTypeColumn() => $redeemer->getMorphClass(), |
|
| 43 | 1 | $this->model->getRedeemerIdColumn() => $redeemer->id, |
|
| 44 | 1 | ])->merge($attributes)->toArray(); |
|
|
|
|||
| 45 | |||
| 46 | 1 | return $this->model->create($fields); |
|
| 47 | } |
||
| 49 |