2015-12-21 13:49:00 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Events;
|
|
|
|
|
|
|
|
use App\Models\Interaction;
|
|
|
|
use App\Models\User;
|
|
|
|
use Illuminate\Queue\SerializesModels;
|
|
|
|
|
|
|
|
class SongLikeToggled extends Event
|
|
|
|
{
|
|
|
|
use SerializesModels;
|
|
|
|
|
|
|
|
/**
|
2016-02-03 15:39:15 +00:00
|
|
|
* The interaction (like/unlike) in action.
|
2016-03-06 04:11:28 +00:00
|
|
|
*
|
2015-12-21 13:49:00 +00:00
|
|
|
* @var Interaction
|
|
|
|
*/
|
|
|
|
public $interaction;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The user who carries the action.
|
2016-03-06 04:11:28 +00:00
|
|
|
*
|
2015-12-21 13:49:00 +00:00
|
|
|
* @var User
|
|
|
|
*/
|
|
|
|
public $user;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Create a new event instance.
|
|
|
|
*
|
|
|
|
* @param Interaction $interaction
|
2015-12-21 13:50:26 +00:00
|
|
|
* @param User $user
|
2015-12-21 13:49:00 +00:00
|
|
|
*/
|
|
|
|
public function __construct(Interaction $interaction, User $user = null)
|
|
|
|
{
|
|
|
|
$this->interaction = $interaction;
|
|
|
|
$this->user = $user ?: auth()->user();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the channels the event should be broadcast on.
|
|
|
|
*
|
|
|
|
* @return array
|
|
|
|
*/
|
|
|
|
public function broadcastOn()
|
|
|
|
{
|
|
|
|
return [];
|
|
|
|
}
|
|
|
|
}
|