fix: don't use hardcoded category ids in random media

This commit is contained in:
Roardom
2024-08-26 11:09:10 +00:00
parent 25d62138b3
commit 3cb5a4f78d
2 changed files with 9 additions and 6 deletions
+3
View File
@@ -36,6 +36,7 @@ class RandomMedia extends Component
return Movie::query()
->select(['id', 'backdrop', 'title', 'release_date'])
->withMin('torrents', 'category_id')
->whereIn('id', $movieIds)
->get();
}
@@ -52,6 +53,7 @@ class RandomMedia extends Component
return Movie::query()
->select(['id', 'backdrop', 'title', 'release_date'])
->withMin('torrents', 'category_id')
->whereIn('id', $movieIds)
->get();
}
@@ -68,6 +70,7 @@ class RandomMedia extends Component
return Tv::query()
->select(['id', 'backdrop', 'name', 'first_air_date'])
->withMin('torrents', 'category_id')
->whereIn('id', $tvIds)
->get();
}
@@ -18,7 +18,7 @@
@foreach ($movies as $key => $movie)
<a
target="_blank"
href="{{ route('torrents.similar', ['category_id' => 1, 'tmdb' => $movie->id]) }}"
href="{{ route('torrents.similar', ['category_id' => $movie->torrents_min_category_id ?? 1, 'tmdb' => $movie->id]) }}"
class="@if ($loop->iteration == 1) media @elseif ($loop->iteration == 2)media1 @else media2 @endif"
style="
background-image: url('{{ \tmdb_image('back_small', $movie->backdrop) }}');
@@ -29,7 +29,7 @@
>
<span style="padding-left: 6px">MOVIE</span>
<div class="media__title">
{{ $movie->title }} ({{ substr($movie->release_date ?? '', 0, 4) ?? '' }})
{{ $movie->title }} ({{ $movie->release_date?->format('Y') }})
</div>
</a>
@endforeach
@@ -37,7 +37,7 @@
@foreach ($tvs as $key => $tv)
<a
target="_blank"
href="{{ route('torrents.similar', ['category_id' => 2, 'tmdb' => $tv->id]) }}"
href="{{ route('torrents.similar', ['category_id' => $tv->torrents_min_category_id ?? 2, 'tmdb' => $tv->id]) }}"
class="@if ($loop->iteration == 1) media3 @elseif ($loop->iteration == 2) media4 @else media5 @endif"
style="
background-image: url('{{ \tmdb_image('back_small', $tv->backdrop) }}');
@@ -48,7 +48,7 @@
>
<span style="padding-left: 6px">TV</span>
<div class="media__title">
{{ $tv->name }} ({{ substr($tv->first_air_date ?? '', 0, 4) ?? '' }})
{{ $tv->name }} ({{ $tv->first_air_date?->format('Y') }})
</div>
</a>
@endforeach
@@ -56,7 +56,7 @@
@foreach ($movies2 as $key => $movie)
<a
target="_blank"
href="{{ route('torrents.similar', ['category_id' => 1, 'tmdb' => $movie->id]) }}"
href="{{ route('torrents.similar', ['category_id' => $movie->torrents_min_category_id ?? 1, 'tmdb' => $movie->id]) }}"
class="@if ($loop->iteration == 1) media6 @elseif ($loop->iteration == 2) media7 @else media8 @endif"
style="
background-image: url('{{ \tmdb_image('back_small', $movie->backdrop) }}');
@@ -67,7 +67,7 @@
>
<span style="padding-left: 6px">MOVIE</span>
<div class="media__title">
{{ $movie->title }} ({{ substr($movie->release_date ?? '', 0, 4) ?? '' }})
{{ $movie->title }} ({{ $movie->release_date?->format('Y') }})
</div>
</a>
@endforeach