File tree Expand file tree Collapse file tree 4 files changed +13
-60
lines changed
Expand file tree Collapse file tree 4 files changed +13
-60
lines changed Original file line number Diff line number Diff line change @@ -34,4 +34,14 @@ protected function getAbstract(): null|string
3434
3535 return Str::excerpt ($ text );
3636 }
37+
38+ public function coverImage (): null |string
39+ {
40+ // Accede al campo 'cover_image' y obtiene el primer archivo
41+ $ file = $ this ->cover_image ()->toFile ();
42+
43+ // Si existe un archivo y es una imagen, devuelve su URL
44+ return $ file && $ file ->isImage () ? $ file ->url () : null ;
45+
46+ }
3747}
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1515 {{ $article -> abstract () } }
1616 </div >
1717 </div >
18- <img src =" {{ $article -> coverImage () } } " >
18+ <img src =" {{ $article -> coverImage () ?? ' ' } } " class = " ml-6 h-28 w-32 object-cover shadow-md " >
1919 </a >
2020 <hr class =" border-t border-gray-200" >
2121 @endforeach
Original file line number Diff line number Diff line change 1919 {!! $highlightedTitle ! !}
2020 </div >
2121 <div class =" font-thin font-inter text-gray-600" >
22- {!! $highlightedSubtitle ! !}
23- {{ $article -> greatings () } }
22+ {{ $article -> abstract () } }
2423 </div >
2524 </div >
26- @empty (! $article -> image () )
27- <img src =" {{ $article -> image ()-> url () } }" alt =" {{ $article -> title () } }" class =" ml-6 h-28 w-32 object-cover shadow-md" >
28- @else
29- <span class =" ml-6 flex h-28 w-32 items-center justify-center bg-gray-200 text-gray-400 shadow-md" aria-hidden =" true" >
30- No image
31- </span >
32- @endempty
25+ <img src =" {{ $article -> coverImage () } }" alt =" {{ $article -> title () } }" class =" ml-6 h-28 w-32 object-cover shadow-md" >
3326 </a >
3427 <hr class =" border-t border-gray-200" >
3528 @endforeach
You can’t perform that action at this time.
0 commit comments