@php
$count = count($data);
$count = ($count > 3) ? 3 : $count;
$i = 1;
@endphp
@if($count)
    @php
        switch ($count ) {
                case 1:
                    $class = 'col-xs-12 banner';
                    break;
                case 2:
                    $class = 'col-sm-6 banner';
                    break;
                case 3:
                    $class = 'col-sm-4 banner';
                    break;
            }
    @endphp

<div class="row banners-wrap">
@foreach($data as $a)
@php
 if($i > 3) {break;}
@endphp

<div class="{{$class}}">
    @if(!is_null($a['ad_link']) && trim($a['ad_link']) != '')
        <a href="{{url($a['ad_link'])}}" title="{{$a['ad_title']}}">
        <img src="{{asset($a['ad_src'])}}" alt="{{$a['ad_title']}}" title="{{$a['ad_title']}}" class="img-responsive">
        </a>
    @else
    <img src="{{asset($a['ad_src'])}}" alt="{{$a['ad_title']}}" title="{{$a['ad_title']}}" class="img-responsive">
    @endif
</div>

@php
    ++$i
@endphp
@endforeach
</div>

@endif