Skip to content

Commit

Permalink
(Update) Finalize Torrent Request System
Browse files Browse the repository at this point in the history
  • Loading branch information
HDVinnie committed Mar 27, 2018
1 parent a1b690e commit 1b35727
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
16 changes: 8 additions & 8 deletions app/Http/Controllers/RequestController.php
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ public function request($id)
// Find the torrent in the database
$torrentRequest = TorrentRequest::findOrFail($id);
$user = auth()->user();
$requestClaim = TorrentRequestClaim::where('request_id', $id)->first();
$torrentRequestClaim = TorrentRequestClaim::where('request_id', $id)->first();
$voters = $torrentRequest->requestBounty()->get();
$comments = $torrentRequest->comments()->latest('created_at')->paginate(6);
$carbon = Carbon::now()->addDay();
Expand All @@ -206,7 +206,7 @@ public function request($id)
}
}

return view('requests.request', ['torrentRequest' => $torrentRequest, 'voters' => $voters, 'user' => $user, 'comments' => $comments, 'carbon' => $carbon, 'movie' => $movie, 'requestClaim' => $requestClaim]);
return view('requests.request', ['torrentRequest' => $torrentRequest, 'voters' => $voters, 'user' => $user, 'comments' => $comments, 'carbon' => $carbon, 'movie' => $movie, 'torrentRequestClaim' => $torrentRequestClaim]);
}

/**
Expand Down Expand Up @@ -380,7 +380,7 @@ public function addBonus(Request $request, $id)
$appurl = config('app.url');
Shoutbox::create(['user' => "1", 'mentions' => "1", 'message' => "User [url={$appurl}/" . $user->username . "." . $user->id . "]" . $user->username . "[/url] has addded " . $request->input('bonus_value') . " BON bounty to request " . "[url={$appurl}/request/" . $torrentRequest->id . "]" . $torrentRequest->name . "[/url]"]);
cache()->forget('shoutbox_messages');
PrivateMessage::create(['sender_id' => "1", 'reciever_id' => $requests->user_id, 'subject' => "Your Request " . $torrentRequest->name . " Has A New Bounty!", 'message' => $user->username . " Has Added A Bounty To " . "[url={$appurl}/request/" . $torrentRequest->id . "]" . $torrentRequest->name . "[/url]"]);
PrivateMessage::create(['sender_id' => "1", 'reciever_id' => $torrentRequest->user_id, 'subject' => "Your Request " . $torrentRequest->name . " Has A New Bounty!", 'message' => $user->username . " Has Added A Bounty To " . "[url={$appurl}/request/" . $torrentRequest->id . "]" . $torrentRequest->name . "[/url]"]);

return redirect()->route('request', ['id' => $request->input('request_id')])->with(Toastr::success('Your bonus has been successfully added.', 'Yay!', ['options']));
} else {
Expand Down Expand Up @@ -444,14 +444,14 @@ public function addRequestModeration($request_id, $info_hash)

$torrentRequest = TorrentRequest::findOrFail($request_id);

$request->filled_by = $user->id;
$request->filled_hash = $info_hash;
$request->filled_when = Carbon::now();
$torrentRequest->filled_by = $user->id;
$torrentRequest->filled_hash = $info_hash;
$torrentRequest->filled_when = Carbon::now();

$request->save();
$torrentRequest->save();

$appurl = config('app.url');
PrivateMessage::create(['sender_id' => "1", 'reciever_id' => $request->user_id, 'subject' => "Your Request " . $request->name . " Has Been Filled!", 'message' => $request->filled_by . " Has Filled Your Request [url={$appurl}/request/" . $torrentRequest->id . "]" . $torrentRequest->name . "[/url]" . " Please Approve or Decline The FullFill! "]);
PrivateMessage::create(['sender_id' => "1", 'reciever_id' => $torrentRequest->user_id, 'subject' => "Your Request " . $torrentRequest->name . " Has Been Filled!", 'message' => $torrentRequest->filled_by . " Has Filled Your Request [url={$appurl}/request/" . $torrentRequest->id . "]" . $torrentRequest->name . "[/url]" . " Please Approve or Decline The FullFill! "]);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions app/TorrentRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ public function torrent()
*/
public function comments()
{
return $this->hasMany(\App\Comment::class);
return $this->hasMany(\App\Comment::class, "requests_id", "id");
}

/**
Expand All @@ -133,7 +133,7 @@ public function comments()
*/
public function requestBounty()
{
return $this->hasMany(\App\TorrentRequestBounty::class);
return $this->hasMany(\App\TorrentRequestBounty::class, "requests_id", "id");
}

/**
Expand Down

0 comments on commit 1b35727

Please sign in to comment.