@if($posts->count() === 0)
@endforeach
No posts yet.
@else
@foreach($posts as $post)
{{ $post->pharmacy?->name }}
{{ $post->created_at?->diffForHumans() }}
more_horiz
@if($post->pharmacy_id === $myPharmacyId)
Edit
@endif
{{ $post->title ?: 'Post' }}
{{ \Illuminate\Support\Str::limit($post->body, 220) }}
@php $mediaPaths = is_array($post->media_paths) && count($post->media_paths) > 0 ? $post->media_paths : ($post->image_path ? [$post->image_path] : []); $pdfPaths = array_values(array_filter($mediaPaths, fn ($p) => is_string($p) && \Illuminate\Support\Str::endsWith(strtolower($p), '.pdf'))); $imagePaths = array_values(array_filter($mediaPaths, fn ($p) => is_string($p) && ! \Illuminate\Support\Str::endsWith(strtolower($p), '.pdf'))); $imageUrls = array_map(fn ($p) => asset($p), $imagePaths); @endphp @if(count($imageUrls) > 0) @if(count($imageUrls) === 1) @else
@foreach($imageUrls as $i => $url)
@endforeach
@endif
@endif
@if(count($pdfPaths) > 0)
@foreach($pdfPaths as $path)
picture_as_pdf
Open PDF
@endforeach
@endif
@if($post->video_url)
play_circle
Open Video
@endif
@if($post->location_url)
location_on
Location
@endif
{{ $posts->links() }}
@endif