diff --git a/app/Http/Controllers/SportsMatchController.php b/app/Http/Controllers/SportsMatchController.php index 3313224..beabeed 100644 --- a/app/Http/Controllers/SportsMatchController.php +++ b/app/Http/Controllers/SportsMatchController.php @@ -34,6 +34,11 @@ class SportsMatchController extends Controller $this->handleImages($match, $request, $nas); $match->save(); + if ($match->video && $match->video->title !== $match->title) { + $match->video->title = $match->title; + $match->video->save(); + } + return response()->json([ 'ok' => true, 'message' => 'Match saved as draft.', @@ -51,6 +56,14 @@ class SportsMatchController extends Controller $this->handleImages($sportsMatch, $request, $nas); $sportsMatch->save(); + // Keep the parent Video's display title in sync with the match title + // so the match page header, share metadata, and search results all + // reflect the edited value. + if ($sportsMatch->video && $sportsMatch->video->title !== $sportsMatch->title) { + $sportsMatch->video->title = $sportsMatch->title; + $sportsMatch->video->save(); + } + return response()->json([ 'ok' => true, 'message' => 'Match updated.', diff --git a/app/Models/SportsMatch.php b/app/Models/SportsMatch.php index 0c89f34..1ebf185 100644 --- a/app/Models/SportsMatch.php +++ b/app/Models/SportsMatch.php @@ -68,7 +68,14 @@ class SportsMatch extends Model ], 'weight_category' => $trim($p['weight_class'] ?? null), 'division' => $trim($c['division'] ?? null), - 'championship' => $trim($c['championship_name'] ?? null) ?? $trim($this->event_name), + // Sub-header "stage" shown between the two yellow lines above + // the weight class (e.g. "Finals", "SEMI FINAL"). Sourced from + // the SportsMatch->title column — the form's "Match title" input. + 'stage' => $trim($this->title), + // "Event title" = the championship / tournament name shown above the + // fighters. Prefer the SportsMatch->event_name column (the field the + // uploader labels "Event title"), fall back to competition.championship_name. + 'championship' => $trim($this->event_name) ?? $trim($c['championship_name'] ?? null), 'match_number' => $trim(($c['match_number'] ?? null) !== null ? (string) $c['match_number'] : null), 'court' => $trim($c['court'] ?? null), 'format' => $trim($c['format'] ?? null), // "3 min", "Best of 3", … diff --git a/resources/views/components/partials/card-styles.blade.php b/resources/views/components/partials/card-styles.blade.php index 91cc47b..2e1af3e 100644 --- a/resources/views/components/partials/card-styles.blade.php +++ b/resources/views/components/partials/card-styles.blade.php @@ -3,9 +3,16 @@ /videos?filter=playlists. Wrapped in @once so it emits only once. --}} @once