@extends('layouts.app') @section('title', 'Video Gallery') @section('content')
{{-- Page Header --}}

Video Gallery

{{-- All Videos Grid --}} @php $hasVideos = false; foreach ($galleries as $gallery) { if ($gallery->videos && count($gallery->videos) > 0) { $hasVideos = true; break; } } @endphp @if($hasVideos)
@foreach($galleries as $gallery) @if($gallery->videos && count($gallery->videos) > 0) {{-- Gallery Title Section --}}
{{ $gallery->title }}
{{-- Videos from this gallery --}} @foreach($gallery->videos as $video) @php $youtubeId = null; // Extract YouTube video ID from various URL formats if (preg_match('/(?:youtube\.com\/watch\?v=|youtu\.be\/|youtube\.com\/embed\/)([^&\?\/]+)/', $video['youtube_url'], $matches)) { $youtubeId = $matches[1]; } @endphp @if($youtubeId)
{{-- YouTube Embed --}}
{{-- Video Title --}}
{{ $video['title'] }}
@if(!empty($video['info']))

{{ $video['info'] }}

@endif
@endif @endforeach {{-- Divider between galleries --}} @if(!$loop->last)

@endif @endif @endforeach
@else
No videos available yet.
@endif
@endsection