diff --git a/resources/views/home/partials/comments.blade.php b/resources/views/home/partials/comments.blade.php index 3edbe96..2c06ce6 100644 --- a/resources/views/home/partials/comments.blade.php +++ b/resources/views/home/partials/comments.blade.php @@ -1,68 +1,81 @@ -

+

{{ __('home.latest-comments') }}

-
+
@foreach ($latestComments as $comment) - @if ($comment->commentable_type == \App\Models\Episode::class) - @php $episode = cache()->rememberForever('commentEpisode'.$comment->commentable_id, fn () => App\Models\Episode::with('gallery')->where('id', $comment->commentable_id)->first()); @endphp -
- -
+ @php + $isEpisode = $comment->commentable_type == \App\Models\Episode::class; + + if ($isEpisode) { + $item = cache()->rememberForever( + 'commentEpisode' . $comment->commentable_id, + fn () => \App\Models\Episode::with('gallery') + ->find($comment->commentable_id) + ); + + $url = route('hentai.index', ['title' => $item->slug]); + $title = $item->title . ' - ' . $item->episode; + $thumbnail = $item->gallery->first()?->thumbnail_url ?? $item->cover_url; + $cover = $item->cover_url; + $resolution = $item->getResolution(); + } else { + $item = cache()->rememberForever( + 'commentHentai' . $comment->commentable_id, + fn () => \App\Models\Hentai::with('gallery', 'episodes') + ->find($comment->commentable_id) + ); + + $episode = $item->episodes->first(); + + $url = route('hentai.index', ['title' => $item->slug]); + $title = $episode?->title; + $thumbnail = $item->gallery->first()?->thumbnail_url ?? $episode?->cover_url; + $cover = $episode?->cover_url; + $resolution = $episode?->getResolution(); + } + @endphp + +
+ +
+ + {{-- Thumbnail --}} + + + {{-- Desktop Thumbnail --}} + {{ $title }} + + {{-- Resolution Badge --}} + + {{ $resolution }} + + + {{-- Gradient Overlay --}} +
+

+ {{ $title }} +

+
+
+ + {{-- Comment Content --}} +
@include('partials.comment', ['comment' => $comment])
-
- @elseif($comment->commentable_type == \App\Models\Hentai::class) - @php $hentai = cache()->rememberForever('commentHentai'.$comment->commentable_id, fn () => App\Models\Hentai::with('gallery', 'episodes')->where('id', $comment->commentable_id)->first()); @endphp - - @endif +
+ @endforeach -
+
\ No newline at end of file