first commit
This commit is contained in:
43
app/Events/CouponWasCollectedEvent.php
Normal file
43
app/Events/CouponWasCollectedEvent.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace App\Events;
|
||||
|
||||
use App\Events\Event;
|
||||
use App\Models\Coupon;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class CouponWasCollectedEvent extends Event
|
||||
{
|
||||
use SerializesModels;
|
||||
|
||||
/**
|
||||
* The coupon referrer.
|
||||
*
|
||||
* @var \App\Models\Coupon
|
||||
*/
|
||||
public $coupon;
|
||||
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @param Coupon $coupon
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Coupon $coupon)
|
||||
{
|
||||
$this->coupon = $coupon;
|
||||
}
|
||||
|
||||
public function broadcastOn()
|
||||
{
|
||||
return ['brand-'.$this->coupon->brand_id];
|
||||
}
|
||||
|
||||
public function broadcastWith()
|
||||
{
|
||||
return [
|
||||
'coupon' => $this->coupon,
|
||||
'user' => $this->coupon->user
|
||||
];
|
||||
}
|
||||
}
|
||||
31
app/Events/CouponsGenerationEvent.php
Normal file
31
app/Events/CouponsGenerationEvent.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace App\Events;
|
||||
|
||||
use App\Events\Event;
|
||||
use App\Models\CouponOrder;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class CouponsGenerationEvent extends Event implements ShouldQueue
|
||||
{
|
||||
use SerializesModels;
|
||||
|
||||
/**
|
||||
* The coupon order referrer.
|
||||
*
|
||||
* @var \App\Models\CouponOrder
|
||||
*/
|
||||
public $couponOrder;
|
||||
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @param CouponOrder $couponOrder
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(CouponOrder $couponOrder)
|
||||
{
|
||||
$this->couponOrder = $couponOrder;
|
||||
}
|
||||
}
|
||||
10
app/Events/Event.php
Normal file
10
app/Events/Event.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App\Events;
|
||||
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
abstract class Event
|
||||
{
|
||||
use SerializesModels;
|
||||
}
|
||||
Reference in New Issue
Block a user