@if (isset($ads_data) && count($ads_data) > 0) @foreach ($ads_data as $ad)
@if ($ad['type'] === 'image') @if ($ad['redirect_url']) {{ $ad['name'] }}
@else {{ $ad['name'] }}
@endif @elseif ($ad['type'] === 'video') @php $isYouTube = str_contains($ad['media'], 'youtube.com') || str_contains($ad['media'], 'youtu.be'); @endphp @if ($isYouTube) @php $videoId = ''; if (str_contains($ad['media'], 'youtu.be/')) { $videoId = explode('/', explode('youtu.be/', $ad['media'])[1])[0]; } elseif (str_contains($ad['media'], 'youtube.com')) { $url = parse_url($ad['media']); parse_str($url['query'] ?? '', $query); $videoId = $query['v'] ?? ''; } @endphp
@if ($ad['redirect_url'])
@endif
@else
{{--
--}} {{--
--}}
@if ($ad['redirect_url'])
@endif
@endif @endif
@endforeach @else
@endif