(Fix) Similar Torrents 🐛

- now respects torrents category
This commit is contained in:
HDVinnie
2019-03-10 18:34:42 -04:00
parent 2a0ff0f883
commit a3c4267b81
4 changed files with 7 additions and 9 deletions
+2 -1
View File
@@ -103,12 +103,13 @@ class TorrentController extends Controller
*
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function similar($tmdb)
public function similar($category_id, $tmdb)
{
$user = auth()->user();
$personal_freeleech = PersonalFreeleech::where('user_id', '=', $user->id)->first();
$torrents = Torrent::with(['user', 'category'])
->withCount(['thanks', 'comments'])
->where('category_id', '=', $category_id)
->where('tmdb', '=', $tmdb)
->latest()
->get();
+1 -1
View File
@@ -15,7 +15,7 @@
</a>
</li>
<li>
<a href="{{ route('torrents.similar', ['tmdb' => $torrents->first()->tmdb]) }}" itemprop="url" class="l-breadcrumb-item-link">
<a href="{{ route('torrents.similar', ['category_id' => $torrents->first()->category_id, 'tmdb' => $torrents->first()->tmdb]) }}" itemprop="url" class="l-breadcrumb-item-link">
<span itemprop="title" class="l-breadcrumb-item-link-title">@lang('torrent.similar')</span>
</a>
</li>
+3 -3
View File
@@ -170,7 +170,7 @@
</a>
@endif
@if ($torrent->tmdb != 0)
<a href="{{ route('torrents.similar', ['tmdb' => $torrent->tmdb]) }}"
<a href="{{ route('torrents.similar', ['category_id' => $torrent->category_id, 'tmdb' => $torrent->tmdb]) }}"
role="button"
class="btn btn-labeled btn-primary">
<span class='btn-label'><i class='{{ config("other.font-awesome") }} fa-file'></i></span> @lang('torrent.similar')</a>
@@ -632,12 +632,12 @@
@foreach($movie->recommendations['results'] as $recommendation)
<div class="item mini backdrop mini_card">
<p class="tv flex">
<a href="{{ route('torrents.similar', ['tmdb' => $recommendation['id']]) }}">
<a href="{{ route('torrents.similar', ['category_id' => $torrent->category_id, 'tmdb' => $recommendation['id']]) }}">
<span class="text-bold">{{ isset($recommendation['title']) ? $recommendation['title'] : $recommendation['name'] }}</span>
</a>
</p>
<div class="image_content">
<a href="{{ route('torrents.similar', ['tmdb' => $recommendation['id']]) }}">
<a href="{{ route('torrents.similar', ['category_id' => $torrent->category_id, 'tmdb' => $recommendation['id']]) }}">
<img class="backdrop" src="https://image.tmdb.org/t/p/w1280{{ $recommendation['backdrop_path'] }}">
<div class="meta">
<span class="release_date"><i class="fas fa-calendar"></i> Year: {{ isset($recommendation['release_date']) ? substr($recommendation['release_date'], 0, 4) : substr($recommendation['first_air_date'], 0, 4) }}</span>
+1 -4
View File
@@ -231,10 +231,7 @@ Route::group(['middleware' => 'language'], function () {
Route::get('/torrents/{slug}.{id}/reseed', 'TorrentController@reseedTorrent')->name('reseed');
Route::post('/torrents/{slug}.{id}/tip_uploader', 'BonusController@tipUploader')->name('tip_uploader');
Route::get('/torrents/{slug}.{id}/freeleech_token', 'TorrentController@freeleechToken')->name('freeleech_token');
// Doesn't follow naming convention but prepping for switch to object.dot
Route::get('/torrents/similar/{tmdb}', 'TorrentController@similar')->name('torrents.similar');
Route::get('/torrents/similar/{category_id}.{tmdb}', 'TorrentController@similar')->name('torrents.similar');
// Achievements
Route::get('/achievements', 'AchievementsController@index')->name('achievements');