@php $album = ! empty($data['album_id']) ? \App\Models\CmsGalleryAlbum::query()->public()->with('items')->find($data['album_id']) : \App\Models\CmsGalleryAlbum::query()->public()->with('items')->latest()->first(); $items = $album?->items->take((int) ($data['limit'] ?? 8)) ?? collect(); @endphp
@if(!empty($data['heading']) || $album)

{{ $data['heading'] ?? $album->title }}

@endif
@forelse($items as $item)
@if($item->type === 'photo' && $item->file_path) {{ $item->caption ?: 'Gallery image' }} @elseif($item->embed_url) Watch video @endif @if($item->caption)
{{ $item->caption }}
@endif
@empty

No gallery items yet.

@endforelse