فهرست منبع

refactor: ⚡️ remove coupon instance from event

IceToast 2 سال پیش
والد
کامیت
4873992c48
1فایلهای تغییر یافته به همراه3 افزوده شده و 2 حذف شده
  1. 3 2
      app/Events/CouponUsedEvent.php

+ 3 - 2
app/Events/CouponUsedEvent.php

@@ -19,9 +19,10 @@ class CouponUsedEvent
      *
      *
      * @return void
      * @return void
      */
      */
-    public function __construct(Coupon $coupon, string $couponCode)
+    public function __construct(string $couponCode)
     {
     {
-        $this->coupon = $coupon;
+
         $this->couponCode = $couponCode;
         $this->couponCode = $couponCode;
+        $this->coupon = Coupon::where('code', $couponCode)->first();
     }
     }
 }
 }