Total Complexity | 3 |
Total Lines | 48 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 3 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
14 | trait HasCoupons |
||
15 | { |
||
16 | /** |
||
17 | * Polymorphic relation to the coupons. |
||
18 | * |
||
19 | * @return MorphToMany |
||
20 | */ |
||
21 | 11 | public function coupons(): MorphToMany |
|
27 | ); |
||
28 | } |
||
29 | |||
30 | /** |
||
31 | * Use the coupon. |
||
32 | * |
||
33 | * @param string $code |
||
34 | * |
||
35 | * @return CouponContract |
||
36 | */ |
||
37 | 13 | public function redeemCoupon(string $code): CouponContract |
|
45 | } |
||
46 | |||
47 | /** |
||
48 | * Check if coupon with this code is already used. |
||
49 | * |
||
50 | * @param string $code |
||
51 | * |
||
52 | * @return bool |
||
53 | */ |
||
54 | 2 | public function isCouponAlreadyUsed(string $code): bool |
|
64 |