ctrlpanel/app/Events/CouponUsedEvent.php
2023-06-08 20:24:15 +02:00

29 lines
592 B
PHP

<?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;
public string $couponCode;
/**
* Create a new event instance.
*
* @return void
*/
public function __construct(string $couponCode)
{
$this->couponCode = $couponCode;
$this->coupon = Coupon::where('code', $couponCode)->first();
}
}