@php
$postImage = null;
if ($post->header) {
$headerPath = filter_var($post->header, FILTER_VALIDATE_URL) ? $post->header : $post->header;
if (filter_var($post->header, FILTER_VALIDATE_URL)) {
$postImage = $headerPath;
} elseif (file_exists(public_path($headerPath))) {
$postImage = asset($headerPath);
} else {
$postImage = asset('cd-project/img/blog/' . (($loop->index % 2) + 1) . '.jpg');
}
} else {
$postImage = asset('cd-project/img/blog/' . (($loop->index % 2) + 1) . '.jpg');
}
@endphp
@if($postImage)
@endif
@if($post->category)
{{ $post->category->name }}
@endif
@php
$desc = $post->description ?? '';
$excerptText = trim($desc) !== '' ? Str::limit($desc, 120)
: (trim($post->excerpt ?? '') !== '' ? Str::limit($post->excerpt, 120)
: Str::limit(strip_tags($post->getAttribute('content') ?? ''), 120));
$excerptText = trim($excerptText) !== '' ? $excerptText : __('Leer artículo completo');
@endphp
{{ $excerptText }}
{{ __('Leer Más') }}