update: torrent details view

This commit is contained in:
HDVinnie
2020-06-04 17:27:57 -04:00
parent 1cd8b86411
commit 2be2650cdb
2 changed files with 12 additions and 20 deletions
+12 -16
View File
@@ -110,7 +110,11 @@ class TorrentController extends Controller
$user = $request->user();
$repository = $this->faceted;
$torrents = Torrent::with(['user', 'category', 'type', 'tags'])->withCount(['thanks', 'comments'])->orderBy('sticky', 'desc')->orderBy('created_at', 'desc')->paginate(25);
$torrents = Torrent::with(['user:id,username', 'category', 'type', 'tags'])
->withCount(['thanks', 'comments'])
->orderBy('sticky', 'desc')
->orderBy('created_at', 'desc')
->paginate(25);
$personal_freeleech = PersonalFreeleech::where('user_id', '=', $user->id)->first();
$bookmarks = Bookmark::where('user_id', $user->id)->get();
@@ -139,7 +143,7 @@ class TorrentController extends Controller
{
$user = $request->user();
$personal_freeleech = PersonalFreeleech::where('user_id', '=', $user->id)->first();
$torrents = Torrent::with(['user', 'category', 'type'])
$torrents = Torrent::with(['user:id,username', 'category', 'type'])
->withCount(['thanks', 'comments'])
->where('category_id', '=', $category_id)
->where('tmdb', '=', $tmdb)
@@ -171,7 +175,7 @@ class TorrentController extends Controller
public function cardLayout(Request $request)
{
$user = $request->user();
$torrents = Torrent::with(['user', 'category', 'type'])->latest()->paginate(33);
$torrents = Torrent::with(['user:id,username', 'category', 'type'])->latest()->paginate(33);
$repository = $this->faceted;
$client = new \App\Services\MovieScrapper(config('api-keys.tmdb'), config('api-keys.tvdb'), config('api-keys.omdb'));
@@ -263,7 +267,7 @@ class TorrentController extends Controller
}
$totals = [];
$counts = [];
$launcher = Torrent::with(['user', 'category', 'type'])->withCount(['thanks', 'comments'])->whereIn('imdb', $fed)->orderBy(self::SORTING, self::ORDER);
$launcher = Torrent::with(['user:id,username', 'category', 'type'])->withCount(['thanks', 'comments'])->whereIn('imdb', $fed)->orderBy(self::SORTING, self::ORDER);
foreach ($launcher->cursor() as $chunk) {
if ($chunk->imdb) {
$totals[$chunk->imdb] = ! array_key_exists($chunk->imdb, $totals) ? 1 : $totals[$chunk->imdb] + 1;
@@ -569,7 +573,7 @@ class TorrentController extends Controller
if (! $history || ! is_array($history)) {
$history = [];
}
$torrent = $torrent->with(['user', 'category', 'type', 'tags'])->withCount(['thanks', 'comments'])->whereNotIn('torrents.id', $history);
$torrent = $torrent->with(['user:id,username', 'category', 'type', 'tags'])->withCount(['thanks', 'comments'])->whereNotIn('torrents.id', $history);
} elseif ($history == 1) {
$torrent = History::where('history.user_id', '=', $user->id);
$torrent->where(function ($query) use ($user, $seedling, $downloaded, $leeching, $idling) {
@@ -598,7 +602,7 @@ class TorrentController extends Controller
$join->on('history.info_hash', '=', 'torrents.info_hash');
})->groupBy('torrents.id');
} else {
$torrent = $torrent->with(['user', 'category', 'type', 'tags'])->withCount(['thanks', 'comments']);
$torrent = $torrent->with(['user:id,username', 'category', 'type', 'tags'])->withCount(['thanks', 'comments']);
}
if ($collection != 1) {
if ($request->has('search') && $request->input('search') != null) {
@@ -725,7 +729,7 @@ class TorrentController extends Controller
}
$totals = [];
$counts = [];
$launcher = Torrent::with(['user', 'category', 'type', 'tags'])->withCount(['thanks', 'comments'])->whereIn('imdb', $fed)->orderBy($sorting, $order);
$launcher = Torrent::with(['user:id,username', 'category', 'type', 'tags'])->withCount(['thanks', 'comments'])->whereIn('imdb', $fed)->orderBy($sorting, $order);
foreach ($launcher->cursor() as $chunk) {
if ($chunk->imdb) {
$totals[$chunk->imdb] = ! array_key_exists($chunk->imdb, $totals) ? 1 : $totals[$chunk->imdb] + 1;
@@ -782,7 +786,7 @@ class TorrentController extends Controller
if (is_array($hungry) && array_key_exists($page - 1, $hungry)) {
$fed = $hungry[$page - 1];
}
$torrents = Torrent::with(['user', 'category', 'type', 'tags'])->withCount(['thanks', 'comments'])->whereIn('id', $fed)->orderBy($sorting, $order)->get();
$torrents = Torrent::with(['user:id,username', 'category', 'type', 'tags'])->withCount(['thanks', 'comments'])->whereIn('id', $fed)->orderBy($sorting, $order)->get();
} else {
$torrents = $torrent->orderBy('sticky', 'desc')->orderBy($sorting, $order)->paginate($qty);
}
@@ -931,14 +935,6 @@ class TorrentController extends Controller
}
}
if (isset($meta) && $meta->recommendations) {
$meta->recommendations['results'] = array_map(function ($recomentaion) {
$recomentaion['exists'] = Torrent::select('tmdb')->where('tmdb', $recomentaion['id'])->get()->isNotEmpty();
return $recomentaion;
}, $meta->recommendations['results']);
}
$characters = null;
if ($torrent->category->game_meta) {
$meta = Game::with(['cover' => ['url', 'image_id'], 'artworks' => ['url', 'image_id'], 'genres' => ['name']])->find($torrent->igdb);
@@ -653,10 +653,6 @@
</div>
</div>
@if ($torrent->category->movie_meta || $torrent->category->tv_meta)
@include('torrent.partials.movie_tv_recommendations')
@endif
<div class="torrent box container" id="comments">
<div class="clearfix"></div>
<div class="row ">