diff --git a/app/Http/Controllers/SportsMatchController.php b/app/Http/Controllers/SportsMatchController.php index b08d92c..3313224 100644 --- a/app/Http/Controllers/SportsMatchController.php +++ b/app/Http/Controllers/SportsMatchController.php @@ -166,7 +166,9 @@ class SportsMatchController extends Controller // Media text fields (caption/alt/credit/public). Preserve existing image // paths already on the record; handleImages() overwrites any replaced ones. $existingMedia = $match->media ?? []; - $mediaText = $this->clean($request->input('media', [])); + // clean() returns null when the array is entirely empty — coerce back to [] + // so array_merge() doesn't blow up on PHP 8's stricter type checking. + $mediaText = $this->clean($request->input('media', [])) ?? []; if (isset($mediaText['public'])) { $mediaText['public'] = filter_var($mediaText['public'], FILTER_VALIDATE_BOOLEAN); } diff --git a/app/Models/SportsMatch.php b/app/Models/SportsMatch.php index ccdf632..0c89f34 100644 --- a/app/Models/SportsMatch.php +++ b/app/Models/SportsMatch.php @@ -44,31 +44,51 @@ class SportsMatch extends Model $p = $this->participants ?? []; $c = $this->competition ?? []; $v = $this->venue ?? []; + $m = $this->media ?? []; + $trim = fn($x) => (is_string($x) && trim($x) !== '') ? trim($x) : null; return [ + 'sport' => $trim($this->sport), 'blue' => [ - 'name' => $this->participant1_name ?: null, - 'club' => $p['p1_club'] ?? null, - 'flag' => $this->flagFor($p['p1_country'] ?? null), + 'name' => $trim($this->participant1_name), + 'club' => $trim($p['p1_club'] ?? null), + 'flag' => $this->flagFor($p['p1_country'] ?? null), + // Uploader form (sports-match modal) stores these under the + // canonical media.* keys — mirror them to headerData() so the + // scoreboard/VS partials get real image paths. + 'club_logo' => $trim($m['club1_logo'] ?? $m['p1_club_logo'] ?? null), + 'headshot' => $trim($m['participant1_photo'] ?? $m['p1_headshot'] ?? null), ], 'red' => [ - 'name' => $this->participant2_name ?: null, - 'club' => $p['p2_club'] ?? null, - 'flag' => $this->flagFor($p['p2_country'] ?? null), + 'name' => $trim($this->participant2_name), + 'club' => $trim($p['p2_club'] ?? null), + 'flag' => $this->flagFor($p['p2_country'] ?? null), + 'club_logo' => $trim($m['club2_logo'] ?? $m['p2_club_logo'] ?? null), + 'headshot' => $trim($m['participant2_photo'] ?? $m['p2_headshot'] ?? null), ], - 'weight_category' => $p['weight_class'] ?? null, - 'championship' => $c['championship_name'] ?? ($this->event_name ?: null), - 'match_number' => $c['match_number'] ?? null, - 'court' => $c['court'] ?? null, + 'weight_category' => $trim($p['weight_class'] ?? null), + 'division' => $trim($c['division'] ?? null), + 'championship' => $trim($c['championship_name'] ?? null) ?? $trim($this->event_name), + '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", … + 'match_date' => $this->match_date?->format('Y-m-d'), 'referee' => [ - 'name' => $this->referee_name ?: null, + 'name' => $trim($this->referee_name), 'flag' => $this->flagFor($p['referee_country'] ?? null), ], 'venue' => [ - 'name' => $this->venue_name ?: ($v['name'] ?? null), - 'map_link' => $v['map_link'] ?? null, + 'name' => $trim($this->venue_name) ?? $trim($v['name'] ?? null), + 'map_link' => $trim($v['map_link'] ?? null), ], - 'event_logo' => $this->media['event_poster'] ?? null, // rel path or null + 'event_logo' => $trim($m['event_poster'] ?? null), + /* + * Per-video overlay defaults set by the uploader. Shape: + * ['scorebar'=>bool, 'feed'=>bool, 'matchInfo'=>bool, 'timeline'=>bool, + * 'clubs'=>bool, 'flags'=>bool, 'penalties'=>bool, 'cornerLabels'=>'auto|redblue|karate|taekwondo'] + * Anything not set falls back to the app defaults in the JS. + */ + 'scoreboard_defaults' => is_array($c['scoreboard'] ?? null) ? $c['scoreboard'] : [], ]; } diff --git a/drafts/2026-08-09_20h35_44.png b/drafts/2026-08-09_20h35_44.png new file mode 100644 index 0000000..c1200f7 Binary files /dev/null and b/drafts/2026-08-09_20h35_44.png differ diff --git a/drafts/2026-08-09_20h37_12.png b/drafts/2026-08-09_20h37_12.png new file mode 100644 index 0000000..1cbe802 Binary files /dev/null and b/drafts/2026-08-09_20h37_12.png differ diff --git a/drafts/Karate match scoreboard overlay.zip b/drafts/Karate match scoreboard overlay.zip new file mode 100644 index 0000000..3932db2 Binary files /dev/null and b/drafts/Karate match scoreboard overlay.zip differ diff --git a/drafts/score-bar.html b/drafts/score-bar.html new file mode 100644 index 0000000..3623c7b --- /dev/null +++ b/drafts/score-bar.html @@ -0,0 +1,94 @@ + + +
+ +