$this->authorize('editRestream', $channel);
$channel->join = true;
$channel->save();
- TwitchBotCommand::join($channel->twitch_chat);
+ TwitchBotCommand::join($channel->twitch_chat, $request->user());
return $channel->toJson();
}
$this->authorize('editRestream', $channel);
$channel->join = false;
$channel->save();
- TwitchBotCommand::part($channel->twitch_chat);
+ TwitchBotCommand::part($channel->twitch_chat, $request->user());
return $channel->toJson();
}
{
use HasFactory;
- public static function join($channel) {
+ public static function join($channel, User $user = null) {
$cmd = new TwitchBotCommand();
$cmd->command = 'join';
$cmd->parameters = [
'channel' => $channel,
];
$cmd->status = 'pending';
+ $cmd->user()->associate($user);
$cmd->save();
}
- public static function part($channel) {
+ public static function part($channel, User $user = null) {
$cmd = new TwitchBotCommand();
$cmd->command = 'part';
$cmd->parameters = [
'channel' => $channel,
];
$cmd->status = 'pending';
+ $cmd->user()->associate($user);
$cmd->save();
}