namespace App\Http\Controllers;
use App\Events\ResultChanged;
+use App\Models\DiscordBotCommand;
use App\Models\Participant;
use App\Models\Protocol;
use App\Models\Result;
$result,
$request->user(),
);
+ DiscordBotCommand::queueResult($result);
} else if ($result->wasChanged('comment')) {
Protocol::resultCommented(
$round->tournament,
{
use HasFactory;
+ public static function queueResult(Result $result) {
+ $cmd = new DiscordBotCommand();
+ $cmd->tournament_id = $result->round->tournament_id;
+ $cmd->command = 'result';
+ $cmd->parameters = [
+ 'round' => $result->round_id,
+ 'user' => $result->user_id,
+ ];
+ $cmd->status = 'pending';
+ $cmd->save();
+ }
+
public function tournament() {
return $this->belongsTo(Tournament::class);
}