{{-- Stack videos vertically --}} {{-- @foreach ($videos as $index => $video) --}} @foreach ($showOnlyFirstVideo ? $videos->take(1) : $videos as $index => $video) @php $videoUrl = $video['link']; $videoId = null; $videoHash = null; $isVimeo = false; if ( preg_match('#(?:https?://)?(?:www\.)?youtube\.com/watch\?v=([a-zA-Z0-9_-]+)#', $videoUrl, $matches) ) { $videoId = $matches[1]; } elseif ( preg_match('#(?:https?://)?(?:www\.)?youtube\.com/shorts/([a-zA-Z0-9_-]{11})#', $videoUrl, $matches) ) { $videoId = $matches[1]; } elseif (preg_match('#(?:https?://)?(?:www\.)?youtu\.be/([a-zA-Z0-9_-]+)#', $videoUrl, $matches)) { $videoId = $matches[1]; } elseif ( preg_match('#(?:https?://)?(?:www\.)?m\.youtube\.com/v/([a-zA-Z0-9_-]+)#', $videoUrl, $matches) ) { $videoId = $matches[1]; } elseif (preg_match('#vimeo\.com/(?:video/)?(\d+)(?:/([a-zA-Z0-9]+))?#', $videoUrl, $matches)) { $videoId = $matches[1]; $videoHash = $matches[2] ?? null; $isVimeo = true; } @endphp
{{-- Vimeo --}} @if ($isVimeo) {{-- YouTube --}} @else @endif {{-- THUMBNAIL OVERLAY --}}
{{-- Play Button --}}
{{-- CUSTOM BUTTON (if exists) --}} @if ($video->button_link) @endif
@endforeach