@props(['url_video' => null]) @php // Extract ID from various YouTube URL formats (watch?v=, share, embed, etc.) $videoId = null; if ($url_video) { preg_match('%(?:youtube(?:-nocookie)?\.com/(?:[^/]+/.+/|(?:v|e(?:mbed)?)/|.*[?&]v=)|youtu\.be/)([^"&?/\s]{11})%i', $url_video, $match); $videoId = $match[1] ?? null; } @endphp
@if($videoId)
video thumbnail
@else

Invalid Video URL

@endif