@extends('layouts.front')
@section('content')
@php
     $firstsectionbig=DB::table('posts')->where('first_section_thumbnail',1)->orderBy('id','DESC')->first();
	 $firstsectionsmall=DB::table('posts')->where('first_section',1)->orderBy('id','DESC')->limit(20)->get();
	 $firstsectionheding=DB::table('posts')->where('headline',1)->orderBy('id','DESC')->limit(12)->get();
	 $post=DB::table('posts')->first();
	 $setting=DB::table('settings')->first();
	 
@endphp
 <!--============Scroll 03 start==============-->
     @php
	 $headline=DB::table('posts')
                        ->join('categories','posts.cat_id','categories.id')
                        ->join('subcategories','posts.subcat_id','subcategories.id')
                        ->select('posts.*','categories.category_bn','subcategories.subcategory_bn')
                        ->where('posts.headline',1)
                        ->orderBy('id','DESC')
                        ->limit(5)
                        ->get();               
     @endphp  
	 
@section('meta')
  <title>ভিডিও গ্যালারি</title>
@endsection
<section class="videoGallery-page py-5">
    <div class="container">

        <!-- Breadcrumb -->
        <nav aria-label="breadcrumb">
            <ol class="breadcrumb bg-light">
                <li class="breadcrumb-item">
                    <a href="{{ URL::to('/') }}">
                        <i class="la la-home"></i> হোম
                    </a>
                </li>
                <li class="breadcrumb-item active" aria-current="page">
                    ভিডিও গ্যালারী
                </li>
            </ol>
        </nav>

        @php
            use Illuminate\Support\Facades\DB;

            $videos = DB::table('videos')
                        ->where('type', 1)
                        ->orderBy('id', 'DESC')
                        ->get();
        @endphp

        <div class="row">

            @forelse($videos as $row)

                <div class="col-lg-4 col-md-6 col-sm-12 mb-4">
                    <div class="card h-100 shadow-sm border-0">

                        <!-- Video Thumbnail -->
                        <div class="position-relative">
                            <img 
                                class="card-img-top img-fluid lazyload"
                                src="{{ asset($setting->lazybaner ?? '') }}"
                                data-src="https://img.youtube.com/vi/{{ $row->embed_code ?? '' }}/mqdefault.jpg"
                                alt="{{ $row->title ?? '' }}"
                            >

                            <a href="https://www.youtube.com/watch?v={{ $row->embed_code ?? '' }}" 
                               target="_blank"
                               class="btn btn-danger btn-sm position-absolute"
                               style="bottom:10px; left:10px;">
                                <i class="las la-play"></i> Play
                            </a>
                        </div>

                        <!-- Video Title -->
                        <div class="card-body">
                            <h6 class="card-title">
                                <a href="https://www.youtube.com/watch?v={{ $row->embed_code ?? '' }}" 
                                   target="_blank" 
                                   class="text-dark font-weight-bold">
                                    {{ $row->title ?? '' }}
                                </a>
                            </h6>
                        </div>

                    </div>
                </div>

            @empty
                <div class="col-12">
                    <div class="alert alert-danger text-center">
                        কোনো ভিডিও পাওয়া যায়নি।
                    </div>
                </div>
            @endforelse

        </div>

    </div>
</section>
@endsection