@props([ 'placement' => 'default', 'class' => '', ]) @php use App\Models\Ad; // Fetch active ads for this placement from database $ads = Ad::byPlacement($placement)->get(); $size = 'responsive'; if ($ads->isNotEmpty()) { $size = $ads->first()->size; } // Determine placeholder content based on placement $placeholders = [ 'header' => ['width' => '728px', 'height' => '90px', 'label' => 'হেডার বিজ্ঞাপন'], 'header_top' => ['width' => '728px', 'height' => '90px', 'label' => 'টপ হেডার বিজ্ঞাপন'], 'home_top' => ['width' => '100%', 'height' => '100px', 'label' => 'হোমপেজ বিজ্ঞাপন'], 'home_hero' => ['width' => '100%', 'height' => '100px', 'label' => 'হিরো সেকশন বিজ্ঞাপন'], 'home_middle' => ['width' => '100%', 'height' => '100px', 'label' => 'মিডল বিজ্ঞাপন'], 'sidebar' => ['width' => '300px', 'height' => '250px', 'label' => 'সাইডবার বিজ্ঞাপন'], 'in_article' => ['width' => '100%', 'height' => '80px', 'label' => 'আর্টিকেল বিজ্ঞাপন'], 'sticky_footer' => ['width' => '100%', 'height' => '50px', 'label' => 'ফুটার বিজ্ঞাপন'], 'default' => ['width' => '100%', 'height' => '90px', 'label' => 'বিজ্ঞাপন'], ]; $placeholder = $placeholders[$placement] ?? $placeholders['default']; @endphp
@forelse($ads as $ad) @if($ad->ad_code) {{-- Custom HTML/AdSense Code --}}
{!! $ad->ad_code !!}
@elseif($ad->image_url) {{-- Image Ad --}} {{ $ad->name }} @endif @empty {{-- Enhanced Placeholder when no ads configured --}}
{{ $placeholder['label'] }} {{ $size }}
@endforelse
@once @push('styles') @endpush @endonce