<?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\Team, App\Mission;
|
|
|
|
class ScoreUpdatedEvent implements ShouldBroadcast
|
|
{
|
|
use Dispatchable, InteractsWithSockets, SerializesModels;
|
|
|
|
public $team_slug;
|
|
public $mission_slug;
|
|
public $score;
|
|
public $complete;
|
|
public $team_score;
|
|
|
|
/**
|
|
* Create a new event instance.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function __construct(Team $team, Mission $mission, $score, $complete, $team_score)
|
|
{
|
|
$this->team_slug = $team->slug;
|
|
$this->mission_slug = $mission->slug;
|
|
$this->score = $score;
|
|
$this->complete = $complete;
|
|
$this->team_score = $team_score;
|
|
}
|
|
|
|
/**
|
|
* Get the channels the event should broadcast on.
|
|
*
|
|
* @return Channel|array
|
|
*/
|
|
public function broadcastOn()
|
|
{
|
|
return ['score'];
|
|
}
|
|
}
|