Conditions | 1 |
Paths | 1 |
Total Lines | 10 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Tests | 8 |
CRAP Score | 1 |
Changes | 6 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
44 | 1 | public function generateCouponFor(Model $redeemer, string $code, array $attributes = []): CouponContract |
|
45 | { |
||
46 | 1 | $fields = collect([ |
|
47 | 1 | $this->model->getCodeColumn() => $code, |
|
48 | 1 | $this->model->getTypeColumn() => CouponContract::TYPE_PERCENTAGE, |
|
49 | 1 | $this->model->getRedeemerTypeColumn() => $redeemer->getMorphClass(), |
|
50 | 1 | $this->model->getRedeemerIdColumn() => $redeemer->id, |
|
51 | 1 | ]); |
|
52 | |||
53 | 1 | return $this->model->create($fields->merge($attributes)->toArray()); |
|
54 | } |
||
56 |