@extends('frontend.master.master') @push('styles') @endpush @section('content') {{ $nama_menu ?? 'Berita dan Artikel' }} @php $picturePath = $data->picture ?? 'noimage.png'; $webOptimizedPath = public_path('storage/' . $picturePath . '_web.jpg'); $imageSrc = file_exists($webOptimizedPath) ? asset('storage/' . $picturePath . '_web.jpg') : asset('storage/' . $picturePath); @endphp {{ $data->title ?? 'Tidak Ada Konten' }} {{ isset($data->scheduled_at) ? \Carbon\Carbon::parse($data->scheduled_at)->format('d F Y') : (isset($data->created_at) ? \Carbon\Carbon::parse($data->created_at)->format('d F Y') : 'Tanggal post') }} {!! !empty($data->description) ? $data->description : 'Tidak Ada Konten' !!} {{-- Gallery Slider --}} @php $galleryField = $data->multifoto ?? $data->gallery_photos ?? null; $gallery = []; if ($galleryField) { if (is_string($galleryField)) { $decoded = json_decode($galleryField, true); $gallery = is_array($decoded) ? $decoded : []; } elseif (is_array($galleryField)) { $gallery = $galleryField; } } $hasGallery = !empty($gallery) && count($gallery) > 0; @endphp @if($hasGallery) @foreach($gallery as $idx => $photo) @php $webOptimizedPath = public_path('storage/' . $photo . '_web.jpg'); $galleryImgSrc = file_exists($webOptimizedPath) ? asset('storage/' . $photo . '_web.jpg') : asset('storage/' . $photo); @endphp @endforeach @endif {{-- Video Section --}} @php $videoUrl = $data->video_url ?? ''; $isEmbed = $videoUrl && (strpos($videoUrl, 'youtube.com') !== false || strpos($videoUrl, 'youtu.be') !== false || strpos($videoUrl, 'vimeo.com') !== false); @endphp @if($videoUrl) @if($isEmbed) @else @endif @endif @if(isset($prevPost)) Post sebelumnya @else Post sebelumnya @endif @if(isset($nextPost)) Post selanjutnya @else Post selanjutnya @endif @endsection @push('scripts') @endpush
Tidak Ada Konten