@extends('layouts.master')
@section('content')

    <section class="blogs">
    <div class="container-fluid">
        <div class="row">
            <div class="col-12">
                <div class="title">
                    <h4>OUR BLOGE</h4>
                </div>
            </div>
        </div>

        <div class="row g-3">
            {{-- Left side for first 2 big blogs --}}
            <div class="col-lg-9 col-md-12">
                <div class="row g-3">
                    @foreach($blogs as $blog)
                        @if($loop->index < 4)
                        <div class="col-md-6">
                            <div class="card big-blog">
                                <div class="card-body">
                                    <div class="image">
                                        <img src="{{ URL::to('public/images/' . $blog->image)}}" class="img-fluid w-100"/>
                                        <span class="badge">{{$blog->post_date}}</span>
                                    </div>
                                    <div class="content">
                                        <h5><a href="{{url('blogdetails')}}/{{$blog->id}}">{{$blog->title}}</a></h5>
                                        <div class="blog-category">
                                            <span><i class="fa fa-user-o" aria-hidden="true"></i> {{$blog->author}}</span>
                                            <span><i class="fa fa-tags" aria-hidden="true"></i> {{$blog->tags}}</span>
                                            <span><i class="fa fa-calendar-o" aria-hidden="true"></i>{{$blog->post_date}}</span>
                                        </div>
                                        <article>{!! substr(strip_tags($blog->description), 0, 1000) !!}...</article>
                                        <a href="{{url('blogdetails')}}/{{$blog->id}}" class="btn btn-primary">Read More</a>
                                    </div>
                                </div>
                            </div>
                        </div>
                        @endif
                    @endforeach
                   
                </div>
            </div>

            {{-- Right side for remaining blogs --}}
            <div class="col-lg-3 col-md-12">
                <div class="card sidebar">
                    <div class="card-body">
                        <div class="recent-posts">
                            <ul>
                                @foreach($blogs as $blog)
                                    @if($loop->index >= 4)
                                    <li>
                                        <a href="/blog-details.html">
                                            <div class="single-blog">
                                                <div class="image">
                                                    <img src="{{ URL::to('public/images/' . $blog->image)}}" class="rounded"/>
                                                </div>
                                                <div class="content">
                                                    <!--<span>{{$blog->post_date}}</span>-->
                                                    <h6><a href="{{url('blogdetails')}}/{{$blog->id}}">{{$blog->title}}</a></h6>
                                                    <div class="blog-category">
                                                        <span><i class="fa fa-user-o" aria-hidden="true"></i> {{$blog->author}}</span>
                                                        <span><i class="fa fa-tags" aria-hidden="true"></i> {{$blog->tags}}</span>
                                                        <span><i class="fa fa-calendar-o" aria-hidden="true"></i>{{$blog->post_date}}</span>
                                                    </div>
                                                    <article>{!! substr(strip_tags($blog->description), 0, 200) !!}...</article>
                                                    <a href="{{url('blogdetails')}}/{{$blog->id}}" class="btn btn-primary">Read More</a>
                                                </div>
                                            </div>
                                        </a>
                                    </li>
                                    @endif
                                @endforeach
                            </ul>
                            
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</section>

    
@endsection

@section('footer')
    @include('layouts.footer')
@endsection