<?php
|
|
|
|
namespace App\Events;
|
|
|
|
use Illuminate\Broadcasting\Channel;
|
|
use Illuminate\Queue\SerializesModels;
|
|
use Illuminate\Broadcasting\PrivateChannel;
|
|
use Illuminate\Broadcasting\PresenceChannel;
|
|
use Illuminate\Foundation\Events\Dispatchable;
|
|
use Illuminate\Broadcasting\InteractsWithSockets;
|
|
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
|
|
|
|
use App\Tweet;
|
|
|
|
class TweetClaimedEvent implements ShouldBroadcast
|
|
{
|
|
use Dispatchable, InteractsWithSockets, SerializesModels;
|
|
|
|
public $tweet_id;
|
|
|
|
/**
|
|
* Create a new event instance.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function __construct(Tweet $tweet)
|
|
{
|
|
$this->tweet_id = $tweet->id;
|
|
}
|
|
|
|
/**
|
|
* Get the channels the event should broadcast on.
|
|
*
|
|
* @return Channel|array
|
|
*/
|
|
public function broadcastOn()
|
|
{
|
|
return ['tweet-queue'];
|
|
}
|
|
}
|