Added YouTube video fetching functionality and update landing page to display videos

This commit is contained in:
2025-07-10 13:59:05 +05:45
parent d85b5a3662
commit 6c2da0d37c
4 changed files with 78 additions and 38 deletions

View File

@ -888,39 +888,27 @@
<!-- Successful Visa Grants -->
<section class="section-padding" style="background-color: #aeb5bb">
@foreach ($success_stories as $story)
<div class="container">
<h2 class="section-title text-center" style="color: #fc4e24">
Trusted by Many Testimonials
</h2>
<div class="row g-3">
<div class="container">
<h2 class="section-title text-center" style="color: #fc4e24">
Trusted by Many Testimonials
</h2>
<div class="row g-3">
@foreach ($videos as $video)
@php
function convertToEmbedUrl($url)
{
$parsed = parse_url($url);
if (isset($parsed['query'])) {
parse_str($parsed['query'], $queryParams);
if (isset($queryParams['v'])) {
return 'https://www.youtube.com/embed/' . $queryParams['v'];
}
}
return $url; // fallback
}
$videoId = $video['id']['videoId'];
$embedUrl = "https://www.youtube.com/embed/{$videoId}";
@endphp
@foreach (json_decode($story->extra_content) as $content)
<div class="col-xl-3 col-lg-4 col-md-6 col-12">
<div class="visa-post">
<iframe width="100%" height="350"
src="{{ convertToEmbedUrl($content->fieldHeader) }}" title="video1" frameborder="0"
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>
</div>
<div class="col-xl-3 col-lg-4 col-md-6 col-12">
<div class="visa-post">
<iframe width="100%" height="350" src="{{ $embedUrl }}" title="YouTube video"
frameborder="0"
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>
</div>
@endforeach
</div>
</div>
@endforeach
</div>
@endforeach
</div>
</section>
<!-- Benefits of choosing TEF -->