{{-- resources/views/noticias/show.blade.php --}} {{ $noticia->titulo }} {{-- Scrollbar sutil para el panel lateral --}} @include('header') @php use Illuminate\Support\Str; use Illuminate\Support\Facades\Storage; $img = $noticia->imagen ?: 'images/no-photo.jpg'; $img = asset(ltrim(str_starts_with($img, '/') ? $img : '/' . ltrim($img, '/'), '/')); $fecha = $noticia->fecha?->locale('es')->translatedFormat('j \\d\\e F, Y'); $lead = Str::limit(strip_tags($noticia->descripcion ?? ''), 260); // Documento PDF $docRaw = $noticia->documento ?? null; $docUrl = null; if ($docRaw) { if (Str::startsWith($docRaw, ['http://', 'https://'])) { $docUrl = $docRaw; } elseif (Str::startsWith($docRaw, ['public/', 'storage/'])) { $docUrl = Str::startsWith($docRaw, 'storage/') ? asset($docRaw) : asset(Storage::url($docRaw)); } else { $docUrl = asset(ltrim($docRaw, '/')); } } $docExists = true; if ($docUrl && !Str::startsWith($docUrl, ['http://', 'https://'])) { $localPath = public_path(parse_url($docUrl, PHP_URL_PATH)); $docExists = file_exists($localPath); } @endphp

{{ $noticia->titulo }}

@if ($lead)

{{ $lead }}

@endif
@if ($fecha)
{{ $fecha }}
@endif
{{ $noticia->titulo }}
{{-- Documento (PDF) --}}

Documento

@if ($docUrl && $docExists)
@else
404 | NO ENCONTRADO

No se pudo localizar el documento asociado a esta noticia.

@endif
{{-- ========= OTRAS NOTICIAS (scrollable) ========= --}}

Otras Noticias

{{-- Contenedor con altura limitada (~3 tarjetas) + scroll --}}
@forelse($others as $item) @php $oImg = $item->imagen ?: 'images/no-photo.jpg'; $oImg = asset( ltrim(str_starts_with($oImg, '/') ? $oImg : '/' . ltrim($oImg, '/'), '/'), ); $oDate = $item->fecha?->locale('es')->translatedFormat('j \\d\\e F, Y'); @endphp
{{ $item->titulo }}

{{ $item->titulo }}

{{ \Illuminate\Support\Str::limit(strip_tags($item->descripcion ?? ''), 120) }}

{{ $oDate }}
@empty
No hay más noticias.
@endforelse
{{-- ======== /OTRAS NOTICIAS ========= --}}
@include('footer')