2023-05-18 19:51:10 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Events;
|
|
|
|
|
|
|
|
use App\Models\Coupon;
|
|
|
|
use Illuminate\Broadcasting\InteractsWithSockets;
|
|
|
|
use Illuminate\Foundation\Events\Dispatchable;
|
|
|
|
use Illuminate\Queue\SerializesModels;
|
|
|
|
|
|
|
|
class CouponUsedEvent
|
|
|
|
{
|
|
|
|
use Dispatchable, InteractsWithSockets, SerializesModels;
|
|
|
|
|
|
|
|
public Coupon $coupon;
|
2023-05-20 19:55:19 +00:00
|
|
|
public string $couponCode;
|
2023-05-18 19:51:10 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Create a new event instance.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
2023-05-26 14:31:23 +00:00
|
|
|
public function __construct(string $couponCode)
|
2023-05-18 19:51:10 +00:00
|
|
|
{
|
2023-05-26 14:31:23 +00:00
|
|
|
|
2023-05-20 19:55:19 +00:00
|
|
|
$this->couponCode = $couponCode;
|
2023-05-26 14:31:23 +00:00
|
|
|
$this->coupon = Coupon::where('code', $couponCode)->first();
|
2023-05-18 19:51:10 +00:00
|
|
|
}
|
|
|
|
}
|