@extends('layouts.front')
@section('contents')
 @section('meta')
<title>{{$searchKey}}</title>
<meta property="og:title" content="{{$searchKey}}" />
<meta property="og:image" content="{{asset('assets/images/'.$gs->og_baner)}}" />
@endsection	 

<div class="container custom-container">
   <div class="row custom-row">
     <div class="left-content-area details-left-content-area">
       <div class="col-lg-12 custom-padding">

         <ol class="breadcrumb details-page-breadcrumb">
           <li><a href="#"><i class="fa fa-home"></i></a></li>
           <li class="active"><a href="#">{{$searchKey}}</a></li>
         </ol><!--/.details-page-breadcrumb-->
         <div class="category-page">
						   
						   

         <div class="row custom-row content_list">
  @if ($results->count()>0)                             
@foreach ($results as $post)
							   <div class="col-md-6 custom-padding">
                  <div class="category-content-single">
                    <a href="{{ route('frontend.postBySubcategory.details',[$post->category->slug,$post->slug])}}">
                      <div class="category-content-single-left">
                        <img class="img-fluid" src="{{asset('assets/images/post/'.$post->image_big)}}" alt="{{ strlen($post->title)>50 ? mb_substr($post->title,0,50,'utf-8').'...' : $post->title}}">
                      </div>
                      <div class="category-content-single-right">
                        <span></span>
                        <h2>{{ strlen($post->title)>50 ? mb_substr($post->title,0,50,'utf-8').'...' : $post->title}}</h2>
                      </div>
                    </a>
                  </div>
                </div>
                    @endforeach 
					@else 
						                            <div class="col-lg-12">
                                <div class="card">
                                    <div class="card-body">
                                        <p class="text-danger text-danger text-center">{{__('No information found.')}}</p>
                                    </div>
                                </div>
                            </div>
                        @endif

					
                                </div>
                            @if ($results->hasPages())
    <div class="custom-pagination text-center mt-4 mb-4">
        <ul class="pagination-list">
            {{-- Previous Page Link --}}
            @if ($results->onFirstPage())
                <li class="disabled"><span>« {{__('Previous')}}</span></li>
            @else
                <li><a href="{{ $results->previousPageUrl() }}" rel="prev">« {{__('Previous')}}</a></li>
            @endif

            {{-- Pagination Elements --}}
            @foreach ($results->links()->elements[0] ?? [] as $page => $url)
                @if ($page == $results->currentPage())
                    <li class="active"><span>{{ $page }}</span></li>
                @else
                    <li><a href="{{ $url }}">{{ $page }}</a></li>
                @endif
            @endforeach

            {{-- Next Page Link --}}
            @if ($results->hasMorePages())
                <li><a href="{{ $results->nextPageUrl() }}" rel="next">{{__('Next')}} »</a></li>
            @else
                <li class="disabled"><span>{{__('Next')}} »</span></li>
            @endif
        </ul>
    </div>
@endif
                   </div>

         <!-- <div class="category-content-btn">
           <div class="details-btn">
             <a href="#" class="btn btn-more-details hvr-bounce-to-right">আরও খবর </a>
           </div>
         </div> -->

       </div><!--/.col-lg-12-->
     </div><!--/.left-content-area-->

     <div class="right-content-area details-right-content-area">
       <div class="col-lg-12 custom-padding">

         <div class="details-page-side-banner">
           {!!$gs->sidebar_ads!!}
         </div><!--/.details-page-side-banner-->

         <div class="details-tab-container">
		     	
           <ul class="nav nav-pills side-tab-main" id="pills-tab" role="tablist">
             <li class="nav-item">
               <a class="nav-link active" id="pills-home-tab" data-toggle="pill" href="#pills-home" role="tab" aria-controls="pills-home" aria-selected="true">{{__('Latest News')}}</a>
             </li>
             <li class="nav-item">
               <a class="nav-link" id="pills-profile-tab" data-toggle="pill" href="#pills-profile" role="tab" aria-controls="pills-profile" aria-selected="false">{{__('Featured News')}}</a>
             </li>
           </ul>

           <div class="tab-content alokitonews-tab-content" id="pills-tabContent">

             <div class="tab-pane fade show active" id="pills-home" role="tabpanel" aria-labelledby="pills-home-tab">
               <div class="least-news">
                 <ul class="least-news-ul detail-least-news-ul">
  
  @php
					$secondcat=DB::table('categories')->where('language_id', $default_language->id)->where('parent_id',null)->skip(1)->first();
					$secondcatpostbig=DB::table('posts')->where('category_id',$secondcat->id)->where('is_trending',1)->orderBy('id','DESC')->get();
					$secondcatpostsmall=DB::table('posts')->where('category_id',$secondcat->id)->where('is_trending',1)->orderBy('id','DESC')->skip(1)->limit(20)->get();
					@endphp  
  
  
 @foreach ($secondcatpostbig as $row)	
  <li><a href="{{ route('frontend.postBySubcategory.details',[$row->id,$row->slug])}}">
    <div class="least-news-left">
      <img src="{{asset('assets/images/post/'.$row->image_big)}}" class="img-fluid" alt="{{strlen($row->title)>60 ? mb_substr($row->title,0,60,"utf-8") : $row->title}}" title="{{strlen($row->title)>60 ? mb_substr($row->title,0,60,"utf-8") : $row->title}}" />
    </div>
    <div class="least-news-right">
      <h3>{{strlen($row->title)>60 ? mb_substr($row->title,0,60,"utf-8") : $row->title}}</h3>
    </div>
  </a></li>
  @endforeach
  
  
 
 </ul><!--/.least-news-ul-->
               </div><!--/.least-news-->
             </div><!--/.tab-pane-->

             <div class="tab-pane fade" id="pills-profile" role="tabpanel" aria-labelledby="pills-profile-tab">
               <div class="least-news">
                 <ul class="least-news-ul detail-least-news-ul">
    
	    @php
					$thirdcat=DB::table('categories')->where('language_id', $default_language->id)->where('parent_id',null)->skip(2)->first();
					$thirdcatpostbig=DB::table('posts')->where('category_id',$thirdcat->id)->where('is_trending',1)->orderBy('id','DESC')->limit(1)->get();
					$thirdcatpostsmall=DB::table('posts')->where('category_id',$thirdcat->id)->where('is_trending',1)->orderBy('id','DESC')->skip(1)->limit(20)->get();
					@endphp 
	
	@foreach ($thirdcatpostbig as $row)
	<li><a href="{{ route('frontend.postBySubcategory.details',[$row->id,$row->slug])}}">
    <div class="least-news-left">
      <img src="{{asset('assets/images/post/'.$row->image_big)}}" class="img-fluid" alt="{{strlen($row->title)>60 ? mb_substr($row->title,0,60,"utf-8") : $row->title}}" title="{{strlen($row->title)>60 ? mb_substr($row->title,0,60,"utf-8") : $row->title}}" />
    </div>
    <div class="least-news-right">
      <h3>{{strlen($row->title)>60 ? mb_substr($row->title,0,60,"utf-8") : $row->title}}</h3>
    </div>
  </a></li>
    @endforeach
  
  
  
  </ul><!--/.least-news-ul-->
               </div><!--/.least-news-->
             </div><!--/.tab-pane-->

           </div><!--/.tab-content-->
         </div><!--/.details-tab-container-->

       </div><!--/.col-lg-12-->
     </div><!--/.right-content-area-->
   </div><!--/.row-->
 </div><!--/.container-->  











@endsection