5 use Illuminate\Broadcasting\Channel as PublicChannel;
6 use Illuminate\Broadcasting\PrivateChannel;
7 use Illuminate\Database\Eloquent\BroadcastsEvents;
8 use Illuminate\Database\Eloquent\Factories\HasFactory;
9 use Illuminate\Database\Eloquent\Model;
11 class GuessingGuess extends Model {
16 public function channel() {
17 return $this->belongsTo(Channel::class);
20 public function broadcastOn($event) {
22 new PrivateChannel('Channel.'.$this->channel_id),
24 if (!empty($this->channel->access_key)) {
25 $channels[] = new PublicChannel('ChannelKey.'.$this->channel->access_key);