]> git.localhorst.tv Git - alttp.git/blobdiff - app/Http/Controllers/ResultController.php
add result VoD links
[alttp.git] / app / Http / Controllers / ResultController.php
index 57f78a157f2d1537cebc3bee96626cd629271a12..ba57c4b0759f45c33b0bb72fe776ec02cc65a5c7 100644 (file)
@@ -20,6 +20,7 @@ class ResultController extends Controller
                        'round_id' => 'required|exists:App\\Models\\Round,id',
                        'time' => 'numeric',
                        'user_id' => 'required|exists:App\\Models\\User,id',
+                       'vod' => 'string|url',
                ]);
 
                $round = Round::findOrFail($validatedData['round_id']);
@@ -36,7 +37,8 @@ class ResultController extends Controller
                        if (isset($validatedData['forfeit'])) $result->forfeit = $validatedData['forfeit'];
                        if (isset($validatedData['time'])) $result->time = $validatedData['time'];
                }
-               $result->comment = $validatedData['comment'] ? $validatedData['comment'] : null;
+               $result->comment = !empty($validatedData['comment']) ? $validatedData['comment'] : null;
+               $result->vod = !empty($validatedData['vod']) ? $validatedData['vod'] : null;
                $result->save();
 
                if ($result->wasChanged()) {
@@ -50,7 +52,7 @@ class ResultController extends Controller
                                $request->user(),
                        );
                        DiscordBotCommand::queueResult($result);
-               } else if ($result->wasChanged('comment')) {
+               } else if ($result->wasChanged(['comment', 'vod'])) {
                        Protocol::resultCommented(
                                $round->tournament,
                                $result,