ctrlpanel/app/Events/CouponUsedEvent.php

29 lines
592 B
PHP
Raw Normal View History

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
*/
public function __construct(string $couponCode)
2023-05-18 19:51:10 +00:00
{
2023-05-20 19:55:19 +00:00
$this->couponCode = $couponCode;
$this->coupon = Coupon::where('code', $couponCode)->first();
2023-05-18 19:51:10 +00:00
}
}