(Update) Refactor Torrent Request System

- renamed  models/functions and more to avoid conflict with
`App\Http\Requests` which will be used to refactor all HTTP Validation
rules into dedicated form requests
This commit is contained in:
HDVinnie
2018-03-22 20:10:37 -04:00
parent 69af59bb1e
commit 87ce42daf3
15 changed files with 222 additions and 222 deletions
+1 -1
View File
@@ -46,6 +46,6 @@ class Category extends Model
*/
public function requests()
{
return $this->hasMany(\App\Requests::class);
return $this->hasMany(\App\TorrentRequest::class);
}
}
+1 -1
View File
@@ -42,7 +42,7 @@ class Comment extends Model
*/
public function request()
{
return $this->belongsTo(\App\Requests::class);
return $this->belongsTo(\App\TorrentRequest::class);
}
/**
+10 -10
View File
@@ -17,7 +17,7 @@ use App\User;
use App\Article;
use App\Comment;
use App\Torrent;
use App\Requests;
use App\TorrentRequest;
use App\Shoutbox;
use App\PrivateMessage;
use App\Achievements\UserMadeComment;
@@ -139,9 +139,9 @@ class CommentController extends Controller
* @param $slug
* @param $id
*/
public function request(Request $req, $id)
public function request(Request $request, $id)
{
$request = Requests::findOrFail($id);
$torrentRequest = TorrentRequest::findOrFail($id);
$user = auth()->user();
// User's comment rights disbabled?
@@ -150,10 +150,10 @@ class CommentController extends Controller
}
$comment = new Comment();
$comment->content = $req->input('content');
$comment->anon = $req->input('anonymous');
$comment->content = $request->input('content');
$comment->anon = $request->input('anonymous');
$comment->user_id = $user->id;
$comment->requests_id = $request->id;
$comment->requests_id = $torrentRequest->id;
$v = validator($comment->toArray(), ['content' => 'required', 'user_id' => 'required', 'requests_id' => 'required']);
if ($v->passes()) {
$comment->save();
@@ -177,21 +177,21 @@ class CommentController extends Controller
// Auto PM
if ($user->id != $request->user_id) {
PrivateMessage::create(['sender_id' => "1", 'reciever_id' => $request->user_id, 'subject' => "Your Request " . $request->name . " Has A New Comment!", 'message' => $comment->user->username . " Has Left A Comment On [url={$appurl}/request/" . $request->id . "]" . $request->name . "[/url]"]);
PrivateMessage::create(['sender_id' => "1", 'reciever_id' => $torrentRequest->user_id, 'subject' => "Your Request " . $torrentRequest->name . " Has A New Comment!", 'message' => $comment->user->username . " Has Left A Comment On [url={$appurl}/request/" . $torrentRequest->id . "]" . $torrentRequest->name . "[/url]"]);
}
// Auto Shout
if ($comment->anon == 0) {
Shoutbox::create(['user' => "1", 'mentions' => "1", 'message' => "User [url={$appurl}/" . $user->username . "." . $user->id . "]" . $user->username . "[/url] has left a comment on Request [url={$appurl}/request/" . $request->id . "]" . $request->name . "[/url]"]);
Shoutbox::create(['user' => "1", 'mentions' => "1", 'message' => "User [url={$appurl}/" . $user->username . "." . $user->id . "]" . $user->username . "[/url] has left a comment on Request [url={$appurl}/request/" . $torrentRequest->id . "]" . $torrentRequest->name . "[/url]"]);
cache()->forget('shoutbox_messages');
} else {
Shoutbox::create(['user' => "1", 'mentions' => "1", 'message' => "An anonymous user has left a comment on request [url={$appurl}/request/" . $request->id . "]" . $request->name . "[/url]"]);
Shoutbox::create(['user' => "1", 'mentions' => "1", 'message' => "An anonymous user has left a comment on request [url={$appurl}/request/" . $torrentRequest->id . "]" . $torrentRequest->name . "[/url]"]);
cache()->forget('shoutbox_messages');
}
} else {
Toastr::error('A Error Has Occured And Your Comment Was Not Posted!', 'Sorry', ['options']);
}
return redirect()->route('request', ['id' => $request->id]);
return redirect()->route('request', ['id' => $torrentRequest->id]);
}
/**
+119 -119
View File
@@ -16,9 +16,9 @@ use Illuminate\Http\Request;
use App\BonTransactions;
use App\Category;
use App\Type;
use App\Requests;
use App\RequestsBounty;
use App\RequestsClaims;
use App\TorrentRequest;
use App\TorrentRequestBounty;
use App\TorrentRequestClaim;
use App\Torrent;
use App\Shoutbox;
use App\User;
@@ -55,20 +55,20 @@ class RequestController extends Controller
public function requests()
{
$user = auth()->user();
$num_req = Requests::count();
$num_fil = Requests::whereNotNull('filled_by')->count();
$num_unfil = Requests::whereNull('filled_by')->count();
$total_bounty = Requests::all()->sum('bounty');
$claimed_bounty = Requests::whereNotNull('filled_by')->sum('bounty');
$unclaimed_bounty = Requests::whereNull('filled_by')->sum('bounty');
$num_req = TorrentRequest::count();
$num_fil = TorrentRequest::whereNotNull('filled_by')->count();
$num_unfil = TorrentRequest::whereNull('filled_by')->count();
$total_bounty = TorrentRequest::all()->sum('bounty');
$claimed_bounty = TorrentRequest::whereNotNull('filled_by')->sum('bounty');
$unclaimed_bounty = TorrentRequest::whereNull('filled_by')->sum('bounty');
$requests = Requests::query();
$torrentRequest = TorrentRequest::query();
$repository = $this->repository;
return view('requests.requests', ['requests' => $requests, 'repository' => $repository, 'user' => $user, 'num_req' => $num_req, 'num_fil' => $num_fil, 'num_unfil' => $num_unfil, 'total_bounty' => $total_bounty, 'claimed_bounty' => $claimed_bounty, 'unclaimed_bounty' => $unclaimed_bounty]);
return view('requests.requests', ['torrentRequest' => $torrentRequest, 'repository' => $repository, 'user' => $user, 'num_req' => $num_req, 'num_fil' => $num_fil, 'num_unfil' => $num_unfil, 'total_bounty' => $total_bounty, 'claimed_bounty' => $claimed_bounty, 'unclaimed_bounty' => $unclaimed_bounty]);
}
public function faceted(Request $request, Requests $requests)
public function faceted(Request $request, TorrentRequest $torrentRequest)
{
$user = auth()->user();
$search = $request->input('search');
@@ -90,63 +90,63 @@ class RequestController extends Controller
$search .= '%' . $term . '%';
}
$requests = $requests->newQuery();
$torrentRequest = $torrentRequest->newQuery();
if ($request->has('search') && $request->input('search') != null) {
$requests->where('name', 'like', $search);
$torrentRequest->where('name', 'like', $search);
}
if ($request->has('imdb') && $request->input('imdb') != null) {
$requests->where('imdb', $imdb);
$torrentRequest->where('imdb', $imdb);
}
if ($request->has('tvdb') && $request->input('tvdb') != null) {
$requests->where('tvdb', $tvdb);
$torrentRequest->where('tvdb', $tvdb);
}
if ($request->has('tmdb') && $request->input('tmdb') != null) {
$requests->where('tmdb', $tmdb);
$torrentRequest->where('tmdb', $tmdb);
}
if ($request->has('mal') && $request->input('mal') != null) {
$requests->where('mal', $mal);
$torrentRequest->where('mal', $mal);
}
if ($request->has('categories') && $request->input('categories') != null) {
$requests->whereIn('category_id', $categories);
$torrentRequest->whereIn('category_id', $categories);
}
if ($request->has('types') && $request->input('types') != null) {
$requests->whereIn('type', $types);
$torrentRequest->whereIn('type', $types);
}
if ($request->has('myrequests') && $request->input('myrequests') != null) {
$requests->where('user_id', $myrequests);
$torrentRequest->where('user_id', $myrequests);
}
if ($request->has('unfilled') && $request->input('unfilled') != null) {
$requests->where('filled_hash', null);
$torrentRequest->where('filled_hash', null);
}
if ($request->has('claimed') && $request->input('claimed') != null) {
$requests->where('claimed', '!=', null)->where('filled_hash', null);
$torrentRequest->where('claimed', '!=', null)->where('filled_hash', null);
}
if ($request->has('pending') && $request->input('pending') != null) {
$requests->where('filled_hash', '!=', null)->where('approved_by', null);
$torrentRequest->where('filled_hash', '!=', null)->where('approved_by', null);
}
if ($request->has('filled') && $request->input('filled') != null) {
$requests->where('filled_hash', '!=', null)->where('approved_by', '!=', null);
$torrentRequest->where('filled_hash', '!=', null)->where('approved_by', '!=', null);
}
// pagination query starts
$rows = $requests->count();
$rows = $torrentRequest->count();
if($request->has('page')){
$page = $request->input('page');
$qty = $request->input('qty');
$requests->skip(($page-1)*$qty);
$torrentRequest->skip(($page-1)*$qty);
$active = $page;
}else{
$active = 1;
@@ -154,20 +154,20 @@ class RequestController extends Controller
if($request->has('qty')){
$qty = $request->input('qty');
$requests->take($qty);
$torrentRequest->take($qty);
}else{
$qty = 6;
$requests->take($qty);
$torrentRequest->take($qty);
}
// pagination query ends
if($request->has('sorting')){
$sorting = $request->input('sorting');
$order = $request->input('direction');
$requests->orderBy($sorting,$order);
$torrentRequest->orderBy($sorting,$order);
}
$listings = $requests->get();
$listings = $torrentRequest->get();
$helper = new RequestViewHelper();
$result = $helper->view($listings);
@@ -185,28 +185,28 @@ class RequestController extends Controller
public function request($id)
{
// Find the torrent in the database
$request = Requests::findOrFail($id);
$torrentRequest = TorrentRequest::findOrFail($id);
$user = auth()->user();
$requestClaim = RequestsClaims::where('request_id', '=', $id)->first();
$voters = $request->requestBounty()->get();
$comments = $request->comments()->orderBy('created_at', 'DESC')->paginate(6);
$requestClaim = TorrentRequestClaim::where('request_id', '=', $id)->first();
$voters = $torrentRequest->requestBounty()->get();
$comments = $torrentRequest->comments()->orderBy('created_at', 'DESC')->paginate(6);
$carbon = Carbon::now()->addDay();
$client = new \App\Services\MovieScrapper(config('api-keys.tmdb'), config('api-keys.tvdb'), config('api-keys.omdb'));
if ($request->category_id == 2) {
if ($request->tmdb || $request->tmdb != 0) {
$movie = $client->scrape('tv', null, $request->tmdb);
if ($torrentRequest->category_id == 2) {
if ($torrentRequest->tmdb || $torrentRequest->tmdb != 0) {
$movie = $client->scrape('tv', null, $torrentRequest->tmdb);
} else {
$movie = $client->scrape('tv', 'tt'. $request->imdb);
$movie = $client->scrape('tv', 'tt'. $torrentRequest->imdb);
}
} else {
if ($request->tmdb || $request->tmdb != 0) {
$movie = $client->scrape('movie', null, $request->tmdb);
if ($torrentRequest->tmdb || $torrentRequest->tmdb != 0) {
$movie = $client->scrape('movie', null, $torrentRequest->tmdb);
} else {
$movie = $client->scrape('movie', 'tt'. $request->imdb);
$movie = $client->scrape('movie', 'tt'. $torrentRequest->imdb);
}
}
return view('requests.request', ['request' => $request, '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, 'requestClaim' => $requestClaim]);
}
/**
@@ -238,7 +238,7 @@ class RequestController extends Controller
$category = Category::findOrFail($request->input('category_id'));
// Holders for new data
$requests = new Requests([
$torrentRequest = new TorrentRequest([
'name' => $request->input('name'),
'description' => $request->input('description'),
'category_id' => $category->id,
@@ -251,12 +251,12 @@ class RequestController extends Controller
'bounty' => $request->input('bounty'),
'votes' => 1,
]);
$requests->save();
$torrentRequest->save();
$requestsBounty = new RequestsBounty([
$requestsBounty = new TorrentRequestBounty([
'user_id' => $user->id,
'seedbonus' => $request->input('bounty'),
'requests_id' => $requests->id,
'requests_id' => $torrentRequest->id,
]);
$requestsBounty->save();
@@ -274,7 +274,7 @@ class RequestController extends Controller
$user->save();
$appurl = config('app.url');
Shoutbox::create(['user' => "1", 'mentions' => "1", 'message' => "User [url={$appurl}/" . $user->username . "." . $user->id . "]" . $user->username . "[/url] has created a new request [url={$appurl}/request/" . $requests->id . "]" . $requests->name . "[/url]"]);
Shoutbox::create(['user' => "1", 'mentions' => "1", 'message' => "User [url={$appurl}/" . $user->username . "." . $user->id . "]" . $user->username . "[/url] has created a new request [url={$appurl}/request/" . $torrentRequest->id . "]" . $torrentRequest->name . "[/url]"]);
cache()->forget('shoutbox_messages');
return redirect('/requests')->with(Toastr::success('Request Added.', 'Yay!', ['options']));
@@ -297,39 +297,39 @@ class RequestController extends Controller
* @access public
* @return Redirect::to
*/
public function editrequest(Request $req, $id)
public function editrequest(Request $request, $id)
{
$user = auth()->user();
$request = Requests::findOrFail($id);
if ($user->group->is_modo || $user->id == $request->user_id) {
$torrentRequest = TorrentRequest::findOrFail($id);
if ($user->group->is_modo || $user->id == $torrentRequest->user_id) {
// Post the Request
if ($req->isMethod('POST')) {
if ($request->isMethod('POST')) {
// Find the right category
$name = $req->input('name');
$imdb = $req->input('imdb');
$tvdb = $req->input('tvdb');
$tmdb = $req->input('tmdb');
$mal = $req->input('mal');
$category = $req->input('category_id');
$type = $req->input('type');
$description = $req->input('description');
$name = $request->input('name');
$imdb = $request->input('imdb');
$tvdb = $request->input('tvdb');
$tmdb = $request->input('tmdb');
$mal = $request->input('mal');
$category = $request->input('category_id');
$type = $request->input('type');
$description = $request->input('description');
$request->name = $name;
$request->imdb = $imdb;
$request->tvdb = $tvdb;
$request->tmdb = $tmdb;
$request->mal = $mal;
$request->category_id = $category;
$request->type = $type;
$request->description = $description;
$request->save();
$torrentRequest->name = $name;
$torrentRequest->imdb = $imdb;
$torrentRequest->tvdb = $tvdb;
$torrentRequest->tmdb = $tmdb;
$torrentRequest->mal = $mal;
$torrentRequest->category_id = $category;
$torrentRequest->type = $type;
$torrentRequest->description = $description;
$torrentRequest->save();
return redirect()->route('requests', ['id' => $request->id])->with(Toastr::success('Request Edited Successfuly.', 'Yay!', ['options']));
return redirect()->route('requests', ['id' => $torrentRequest->id])->with(Toastr::success('Request Edited Successfuly.', 'Yay!', ['options']));
} else {
return view('requests.edit_request', ['categories' => Category::all()->sortBy('position'), 'types' => Type::all()->sortBy('position'), 'user' => $user, 'request' => $request]);
return view('requests.edit_request', ['categories' => Category::all()->sortBy('position'), 'types' => Type::all()->sortBy('position'), 'user' => $user, 'torrentRequest' => $torrentRequest]);
}
} else {
return redirect()->route('requests', ['id' => $request->id])->with(Toastr::error('You Dont Have Access To This Operation!', 'Whoops!', ['options']));
return redirect()->route('requests', ['id' => $torrentRequest->id])->with(Toastr::error('You Dont Have Access To This Operation!', 'Whoops!', ['options']));
}
}
@@ -350,17 +350,17 @@ class RequestController extends Controller
]);
if ($v->passes()) {
$requests = Requests::findOrFail($request->input('request_id'));
$torrentRequest = TorrentRequest::findOrFail($request->input('request_id'));
$requests->votes += 1;
$requests->bounty += $request->input('bonus_value');
$requests->created_at = Carbon::now();
$requests->save();
$torrentRequest->votes += 1;
$torrentRequest->bounty += $request->input('bonus_value');
$torrentRequest->created_at = Carbon::now();
$torrentRequest->save();
$requestsBounty = new RequestsBounty([
$requestsBounty = new TorrentRequestBounty([
'user_id' => $user->id,
'seedbonus' => $request->input('bonus_value'),
'requests_id' => $requests->id,
'requests_id' => $torrentRequest->id,
]);
$requestsBounty->save();
@@ -370,7 +370,7 @@ class RequestController extends Controller
'cost' => $request->input('bonus_value'),
'sender' => $user->id,
'receiver' => 0,
'comment' => "adding bonus to {$requests->name}"
'comment' => "adding bonus to {$torrentRequest->name}"
]);
$BonTransactions->save();
@@ -378,9 +378,9 @@ class RequestController extends Controller
$user->save();
$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/" . $requests->id . "]" . $requests->name . "[/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 " . $requests->name . " Has A New Bounty!", 'message' => $user->username . " Has Added A Bounty To " . "[url={$appurl}/request/" . $requests->id . "]" . $requests->name . "[/url]"]);
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]"]);
return redirect()->route('request', ['id' => $request->input('request_id')])->with(Toastr::success('Your bonus has been successfully added.', 'Yay!', ['options']));
} else {
@@ -442,7 +442,7 @@ class RequestController extends Controller
{
$user = auth()->user();
$request = Requests::findOrFail($request_id);
$torrentRequest = TorrentRequest::findOrFail($request_id);
$request->filled_by = $user->id;
$request->filled_hash = $info_hash;
@@ -451,7 +451,7 @@ class RequestController extends Controller
$request->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/" . $request->id . "]" . $request->name . "[/url]" . " Please Approve or Decline The FullFill! "]);
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! "]);
}
/**
@@ -463,16 +463,16 @@ class RequestController extends Controller
{
$user = auth()->user();
$request = Requests::findOrFail($id);
$torrentRequest = TorrentRequest::findOrFail($id);
if ($user->id == $request->user_id || auth()->user()->group->is_modo) {
$request->approved_by = $user->id;
$request->approved_when = Carbon::now();
$request->save();
if ($user->id == $torrentRequest->user_id || auth()->user()->group->is_modo) {
$torrentRequest->approved_by = $user->id;
$torrentRequest->approved_when = Carbon::now();
$torrentRequest->save();
//BON and torrent request hash code below
$fill_user = User::findOrFail($request->filled_by);
$fill_amount = $request->bounty;
$fill_user = User::findOrFail($torrentRequest->filled_by);
$fill_amount = $torrentRequest->bounty;
$BonTransactions = new BonTransactions([
'itemID' => 0,
@@ -480,7 +480,7 @@ class RequestController extends Controller
'cost' => $fill_amount,
'sender' => 0,
'receiver' => $fill_user->id,
'comment' => "{$fill_user->username} has filled {$request->name} and has been awared {$fill_amount} BONUS."
'comment' => "{$fill_user->username} has filled {$torrentRequest->name} and has been awared {$fill_amount} BONUS."
]);
$BonTransactions->save();
@@ -495,10 +495,10 @@ class RequestController extends Controller
$fill_user->addProgress(new UserFilled100Requests(), 1);
$appurl = config('app.url');
Shoutbox::create(['user' => "1", 'mentions' => "1", 'message' => "User [url={$appurl}/" . $fill_user->username . "." . $fill_user->id . "]" . $fill_user->username . "[/url] has filled [url={$appurl}/request/" . $request->id . "]" . $request->name . "[/url] and was awarded " . $fill_amount . " BON "]);
Shoutbox::create(['user' => "1", 'mentions' => "1", 'message' => "User [url={$appurl}/" . $fill_user->username . "." . $fill_user->id . "]" . $fill_user->username . "[/url] has filled [url={$appurl}/request/" . $torrentRequest->id . "]" . $torrentRequest->name . "[/url] and was awarded " . $fill_amount . " BON "]);
cache()->forget('shoutbox_messages');
PrivateMessage::create(['sender_id' => "1", 'reciever_id' => $request->filled_by, 'subject' => "Your Request Fullfill On " . $request->name . " Has Been Approved!", 'message' => $request->approved_by . " Has Approved Your Fullfillment On [url={$appurl}/request/" . $request->id . "]" . $request->name . "[/url] Enjoy The " . $request->bounty . " Bonus Points!"]);
return redirect()->route('request', ['id' => $id])->with(Toastr::success("You have approved {$request->name} and the bounty has been awarded to {$fill_user->username}", "Yay!", ['options']));
PrivateMessage::create(['sender_id' => "1", 'reciever_id' => $torrentRequest->filled_by, 'subject' => "Your Request Fullfill On " . $torrentRequest->name . " Has Been Approved!", 'message' => $torrentRequest->approved_by . " Has Approved Your Fullfillment On [url={$appurl}/request/" . $torrentRequest->id . "]" . $torrentRequest->name . "[/url] Enjoy The " . $torrentRequest->bounty . " Bonus Points!"]);
return redirect()->route('request', ['id' => $id])->with(Toastr::success("You have approved {$torrentRequest->name} and the bounty has been awarded to {$fill_user->username}", "Yay!", ['options']));
} else {
return redirect()->route('request', ['id' => $id])->with(Toastr::error("You don't have access to approve this request", 'Whoops!', ['options']));
}
@@ -513,16 +513,16 @@ class RequestController extends Controller
{
$user = auth()->user();
$request = Requests::findOrFail($id);
$torrentRequest = TorrentRequest::findOrFail($id);
if ($user->id == $request->user_id) {
PrivateMessage::create(['sender_id' => "1", 'reciever_id' => $request->filled_by, 'subject' => "Your Request Fullfill On " . $request->name . " Has Been Declined!", 'message' => $user->username . " Has Declined Your Fullfillment On [url={$appurl}/request/" . $request->id . "]" . $request->name . "[/url] It did not meet the requirements!"]);
if ($user->id == $torrentRequest->user_id) {
PrivateMessage::create(['sender_id' => "1", 'reciever_id' => $torrentRequest->filled_by, 'subject' => "Your Request Fullfill On " . $torrentRequest->name . " Has Been Declined!", 'message' => $user->username . " Has Declined Your Fullfillment On [url={$appurl}/request/" . $torrentRequest->id . "]" . $torrentRequest->name . "[/url] It did not meet the requirements!"]);
$request->filled_by = null;
$request->filled_when = null;
$request->filled_hash = null;
$torrentRequest->filled_by = null;
$torrentRequest->filled_when = null;
$torrentRequest->filled_hash = null;
$request->save();
$torrentRequest->save();
return redirect()->route('request', ['id' => $id])->with(Toastr::success("This request has been reset.", 'Yay!', ['options']));
} else {
@@ -538,11 +538,11 @@ class RequestController extends Controller
public function deleteRequest($id)
{
$user = auth()->user();
$request = Requests::findOrFail($id);
$torrentRequest = TorrentRequest::findOrFail($id);
if ($user->group->is_modo || $request->user_id == $user->id) {
$name = $request->name;
$request->delete();
if ($user->group->is_modo || $torrentRequest->user_id == $user->id) {
$name = $torrentRequest->name;
$torrentRequest->delete();
return redirect()->route('requests')->with(Toastr::success("You have deleted {$name}", 'Yay!', ['options']));
} else {
@@ -555,21 +555,21 @@ class RequestController extends Controller
* @method claimRequest
*
*/
public function claimRequest(Request $req, $id)
public function claimRequest(Request $request, $id)
{
$user = auth()->user();
$request = Requests::findOrFail($id);
$torrentRequest = TorrentRequest::findOrFail($id);
if ($request->claimed == null) {
$requestClaim = new RequestsClaims([
if ($torrentRequest->claimed == null) {
$requestClaim = new TorrentRequestClaim([
'request_id' => $id,
'username' => $user->username,
'anon' => $req->input('anon'),
'anon' => $request->input('anon'),
]);
$requestClaim->save();
$request->claimed = 1;
$request->save();
$torrentRequest->claimed = 1;
$torrentRequest->save();
return redirect()->route('request', ['id' => $id])->with(Toastr::success("Request Successfuly Claimed", 'Yay!', ['options']));
} else {
@@ -585,16 +585,16 @@ class RequestController extends Controller
public function unclaimRequest($id)
{
$user = auth()->user();
$request = Requests::findOrFail($id);
$claimer = RequestsClaims::where('request_id', '=', $id)->first();
$torrentRequest = TorrentRequest::findOrFail($id);
$claimer = TorrentRequestClaim::where('request_id', '=', $id)->first();
if ($user->group->is_modo || $user->username == $claimer->username) {
if ($request->claimed == 1) {
$requestClaim = RequestsClaims::where('request_id', '=', $id)->firstOrFail();
if ($torrentRequest->claimed == 1) {
$requestClaim = TorrentRequestClaim::where('request_id', '=', $id)->firstOrFail();
$requestClaim->delete();
$request->claimed = null;
$request->save();
$torrentRequest->claimed = null;
$torrentRequest->save();
return redirect()->route('request', ['id' => $id])->with(Toastr::success("Request Successfuly Un-Claimed", 'Yay!', ['options']));
} else {
@@ -14,7 +14,7 @@ namespace App\Http\Controllers\Staff;
use App\User;
use App\Torrent;
use App\Requests;
use App\TorrentRequest;
use App\PrivateMessage;
use App\Helpers\TorrentHelper;
use App\Http\Controllers\Controller;
@@ -128,13 +128,13 @@ class ModerationController extends Controller
$user = auth()->user();
// reset code here
if ($user->group->is_modo) {
$request = Requests::findOrFail($id);
$request->filled_by = null;
$request->filled_when = null;
$request->filled_hash = null;
$request->approved_by = null;
$request->approved_when = null;
$request->save();
$torrentRequest = TorrentRequest::findOrFail($id);
$torrentRequest->filled_by = null;
$torrentRequest->filled_when = null;
$torrentRequest->filled_hash = null;
$torrentRequest->approved_by = null;
$torrentRequest->approved_when = null;
$torrentRequest->save();
return redirect()->route('request', ['id' => $id])->with(Toastr::success("The request has been reset!", 'Yay!', ['options']));
} else {
+2 -2
View File
@@ -18,7 +18,7 @@ use App\Torrent;
use App\Peer;
use App\History;
use App\BonTransactions;
use App\Requests;
use App\TorrentRequest;
use App\Group;
use Carbon\Carbon;
@@ -208,7 +208,7 @@ class StatsController extends Controller
public function bountied()
{
// Fetch Top Bountied
$bountied = Requests::orderBy('bounty', 'DESC')->take(100)->get();
$bountied = TorrentRequest::orderBy('bounty', 'DESC')->take(100)->get();
return view('stats.requests.bountied', ['bountied' => $bountied]);
}
+5 -5
View File
@@ -25,8 +25,8 @@ use App\Type;
use App\Peer;
use App\Page;
use App\PrivateMessage;
use App\Requests;
use App\RequestsBounty;
use App\TorrentRequest;
use App\TorrentRequestBounty;
use App\Warning;
use App\User;
use App\BonTransactions;
@@ -927,11 +927,11 @@ class TorrentController extends Controller
\LogActivity::addToLog("Member {$user->username} has deleted torrent {$torrent->name} .");
//Remove requests
$reqs = Requests::where('filled_hash', '=', $torrent->info_hash)->get();
foreach ($reqs as $req) {
$torrentRequest = TorrentRequest::where('filled_hash', '=', $torrent->info_hash)->get();
foreach ($torrentRequest as $req) {
if ($req) {
Comment::where('requests_id', '=', $req->id)->delete();
RequestsBounty::where('requests_id', '=', $req->id)->delete();
TorrentRequestBounty::where('requests_id', '=', $req->id)->delete();
$req->delete();
}
}
+2 -2
View File
@@ -19,7 +19,7 @@ use App\Helpers\Bbcode;
* Torrent Requests
*
*/
class Requests extends Model
class TorrentRequest extends Model
{
/**
@@ -133,7 +133,7 @@ class Requests extends Model
*/
public function requestBounty()
{
return $this->hasMany(\App\RequestsBounty::class);
return $this->hasMany(\App\TorrentRequestBounty::class);
}
/**
@@ -14,7 +14,7 @@ namespace App;
use Illuminate\Database\Eloquent\Model;
class RequestsBounty extends Model
class TorrentRequestBounty extends Model
{
/**
* The database table used by the model.
@@ -44,6 +44,6 @@ class RequestsBounty extends Model
*/
public function request()
{
return $this->belongsTo(\App\Requests::class);
return $this->belongsTo(\App\TorrentRequest::class);
}
}
@@ -14,7 +14,7 @@ namespace App;
use Illuminate\Database\Eloquent\Model;
class RequestsClaims extends Model
class TorrentRequestClaim extends Model
{
/**
* The database table used by the model.
+1 -1
View File
@@ -44,6 +44,6 @@ class Type extends Model
*/
public function requests()
{
return $this->hasMany(\App\Requests::class);
return $this->hasMany(\App\TorrentRequest::class);
}
}
+4 -4
View File
@@ -192,7 +192,7 @@ class User extends Authenticatable
*/
public function requests()
{
return $this->hasMany(\App\Requests::class);
return $this->hasMany(\App\TorrentRequest::class);
}
/**
@@ -201,7 +201,7 @@ class User extends Authenticatable
*/
public function ApprovedRequests()
{
return $this->hasMany(\App\Requests::class, 'approved_by');
return $this->hasMany(\App\TorrentRequest::class, 'approved_by');
}
/**
@@ -210,7 +210,7 @@ class User extends Authenticatable
*/
public function FilledRequests()
{
return $this->hasMany(\App\Requests::class, 'filled_by');
return $this->hasMany(\App\TorrentRequest::class, 'filled_by');
}
/**
@@ -219,7 +219,7 @@ class User extends Authenticatable
*/
public function requestBounty()
{
return $this->hasMany(\App\RequestsBounty::class);
return $this->hasMany(\App\TorrentRequestBounty::class);
}
/**
@@ -37,37 +37,37 @@
</div>
@else
<h1 class="upload-title">{{ trans('request.edit-request') }}</h1>
{{ Form::open(array('route' => array('edit_request', 'id' => $request->id))) }}
{{ Form::open(array('route' => array('edit_request', 'id' => $torrentRequest->id))) }}
<div class="block">
<div class="form-group">
<label for="name">{{ trans('request.title') }}</label>
<input type="text" name="name" class="form-control" value="{{ $request->name }}" required>
<input type="text" name="name" class="form-control" value="{{ $torrentRequest->name }}" required>
</div>
<div class="form-group">
<label for="name">IMDB ID ({{ trans('request.required') }})</label>
<input type="number" name="imdb" value="{{ $request->imdb }}" class="form-control" required>
<input type="number" name="imdb" value="{{ $torrentRequest->imdb }}" class="form-control" required>
</div>
<div class="form-group">
<label for="name">TMDB ID </label>
<input type="number" name="tmdb" value="{{ $request->tmdb }}" class="form-control" required>
<input type="number" name="tmdb" value="{{ $torrentRequest->tmdb }}" class="form-control" required>
</div>
<div class="form-group">
<label for="name">TVDB ID </label>
<input type="number" name="tvdb" value="{{ $request->tvdb }}" class="form-control" required>
<input type="number" name="tvdb" value="{{ $torrentRequest->tvdb }}" class="form-control" required>
</div>
<div class="form-group">
<label for="name">MAL ID </label>
<input type="number" name="mal" value="{{ $request->mal }}" class="form-control" required>
<input type="number" name="mal" value="{{ $torrentRequest->mal }}" class="form-control" required>
</div>
<div class="form-group">
<label for="category_id">{{ trans('request.category') }}</label>
<select name="category_id" class="form-control">
<option value="{{ $request->category->id }}" selected>{{ $request->category->name }} ({{ trans('request.current') }})</option>
<option value="{{ $torrentRequest->category->id }}" selected>{{ $torrentRequest->category->name }} ({{ trans('request.current') }})</option>
@foreach($categories as $category)
<option value="{{ $category->id }}">{{ $category->name }}</option>
@endforeach
@@ -77,7 +77,7 @@
<div class="form-group">
<label for="type">{{ trans('request.type') }}</label>
<select name="type" class="form-control">
<option value="{{ $request->type }}" selected>{{ $request->type }} ({{ trans('request.current') }})</option>
<option value="{{ $torrentRequest->type }}" selected>{{ $torrentRequest->type }} ({{ trans('request.current') }})</option>
@foreach($types as $type)
<option value="{{ $type->name }}">{{ $type->name }}</option>
@endforeach
@@ -86,7 +86,7 @@
<div class="form-group">
<label for="description">{{ trans('request.description') }}</label>
<textarea id="request-form-description" name="description" cols="30" rows="10" class="form-control">{{ $request->description }}</textarea>
<textarea id="request-form-description" name="description" cols="30" rows="10" class="form-control">{{ $torrentRequest->description }}</textarea>
</div>
<button type="submit" class="btn btn-primary">{{ trans('common.submit') }}</button>
+44 -44
View File
@@ -11,7 +11,7 @@
</a>
</li>
<li>
<a href="{{ route('request', ['id' => $request->id]) }}" itemprop="url" class="l-breadcrumb-item-link">
<a href="{{ route('request', ['id' => $torrentRequest->id]) }}" itemprop="url" class="l-breadcrumb-item-link">
<span itemprop="title" class="l-breadcrumb-item-link-title">{{ trans('request.request-details') }}</span>
</a>
</li>
@@ -33,40 +33,40 @@
</div>
@else
<h1 class="title h2">
{{ $request->name }}
{{ $torrentRequest->name }}
<span class="text-green">{{ trans('request.for') }} <i class="fa fa-star text-gold">
</i> <strong>{{ $request->bounty }}</strong> {{ trans('bon.bon') }}</span>
</i> <strong>{{ $torrentRequest->bounty }}</strong> {{ trans('bon.bon') }}</span>
</h1>
<div class="block">
<div class="row mb-10">
<div class="col-sm-12">
<div class="pull-right">
<button class="btn btn-xs btn-danger" data-toggle="modal" data-target="#modal_request_report"><i class="fa fa-eye"></i> {{ trans('request.report') }}</button>
@if($request->filled_hash == null)
@if($torrentRequest->filled_hash == null)
<button class="btn btn-xs btn-success btn-vote-request" data-toggle="modal" data-target="#vote"><i class="fa fa-thumbs-up">
</i> {{ trans('request.vote') }}</button>
@if($request->claimed == 1 && $requestClaim->username == $user->username || $user->group->is_modo)
@if($torrentRequest->claimed == 1 && $torrentRequestClaim->username == $user->username || $user->group->is_modo)
<button id="btn_fulfil_request" class="btn btn-xs btn-info" data-toggle="modal" data-target="#fill"><i class="fa fa-link">
</i> {{ trans('request.fulfill') }}</button>
@elseif($request->claimed == 0)
@elseif($torrentRequest->claimed == 0)
<button id="btn_fulfil_request" class="btn btn-xs btn-info" data-toggle="modal" data-target="#fill"><i class="fa fa-link">
</i> {{ trans('request.fulfill') }}</button>
@endif @endif @if($user->group->is_modo && $request->filled_hash != null)
@endif @endif @if($user->group->is_modo && $torrentRequest->filled_hash != null)
<button class="btn btn-xs btn-warning" data-toggle="modal" data-target="#reset"><i class="fa fa-undo">
</i> {{ trans('request.reset-request') }}</button>
@endif @if($user->group->is_modo || ($request->user->id == $user->id && $request->filled_hash == null))
<a class="btn btn-warning btn-xs" href="{{ route('edit_request', array('id' => $request->id)) }}" role="button"><i class="fa fa-pencil-square-o" aria-hidden="true"> {{ trans('request.edit-request') }}</i></a>
@endif @if($user->group->is_modo || ($torrentRequest->user->id == $user->id && $torrentRequest->filled_hash == null))
<a class="btn btn-warning btn-xs" href="{{ route('edit_request', array('id' => $torrentRequest->id)) }}" role="button"><i class="fa fa-pencil-square-o" aria-hidden="true"> {{ trans('request.edit-request') }}</i></a>
<button class="btn btn-xs btn-danger" data-toggle="modal" data-target="#delete"><i class="fa fa-trash-o">
</i> {{ trans('common.delete') }}</button>
@endif
</div>
</div>
</div>
@if($request->category->meta == 1)
@if($torrentRequest->category->meta == 1)
<div class="movie-wrapper">
<div class="movie-backdrop" style="background-image: url({{ $movie->backdrop }});">
<div class="tags">
{{ $request->category->name }}
{{ $torrentRequest->category->name }}
</div>
</div>
<div class="movie-overlay"></div>
@@ -96,7 +96,7 @@
<li>
<span class="badge-extra text-bold text-orange">
<a rel="nofollow" href="https://anon.to?http://www.imdb.com/title/{{ $movie->imdb }}" title="IMDB" target="_blank">IMDB: {{ $movie->imdb }}</a>
</span> @if($request->category_id == "2")
</span> @if($torrentRequest->category_id == "2")
<span class="badge-extra text-bold text-orange">
<a rel="nofollow" href="https://anon.to?https://www.themoviedb.org/tv/{{ $movie->tmdb }}" title="TheMovieDatabase" target="_blank">TMDB: {{ $movie->tmdb }}</a>
</span> @else
@@ -122,7 +122,7 @@
<strong>{{ trans('torrent.title') }}</strong>
</td>
<td>
{{ $request->name }}
{{ $torrentRequest->name }}
</td>
</tr>
<tr>
@@ -130,7 +130,7 @@
<strong>{{ trans('torrent.category') }}</strong>
</td>
<td>
<i class="{{ $request->category->icon }} torrent-icon torrent-icon-small" data-toggle="tooltip" title="" data-original-title="{{ $request->category->name }} Torrent"></i> {{ $request->category->name }}
<i class="{{ $torrentRequest->category->icon }} torrent-icon torrent-icon-small" data-toggle="tooltip" title="" data-original-title="{{ $torrentRequest->category->name }} Torrent"></i> {{ $torrentRequest->category->name }}
</td>
</tr>
<tr>
@@ -138,7 +138,7 @@
<strong>{{ trans('torrent.type') }}</strong>
</td>
<td>
{{ $request->type }}
{{ $torrentRequest->type }}
</td>
</tr>
<tr>
@@ -148,8 +148,8 @@
<td>
<i class="fa fa-star text-gold">
</i>
<strong>{{ $request->bounty }}</strong> {{ trans('bon.bon') }} {{ strtolower(trans('request.reward-from')) }}
<strong>{{ $request->requestBounty->count() }}</strong> {{ strtolower(trans('request.voters')) }}
<strong>{{ $torrentRequest->bounty }}</strong> {{ trans('bon.bon') }} {{ strtolower(trans('request.reward-from')) }}
<strong>{{ $torrentRequest->requestBounty->count() }}</strong> {{ strtolower(trans('request.voters')) }}
</td>
</tr>
<tr>
@@ -159,7 +159,7 @@
<td>
<div class="panel-body torrent-desc">
<p>
@emojione($request->getDescriptionHtml())
@emojione($torrentRequest->getDescriptionHtml())
</p>
</div>
</td>
@@ -169,8 +169,8 @@
<strong>{{ trans('request.requested-by') }}</strong>
</td>
<td>
<span class="badge-user"><a href="{{ route('profil', ['username' => $request->user->username, 'id' => $request->user->id]) }}" title="">{{ $request->user->username }}</a></span>
<span class="badge-extra">{{ $request->created_at->diffForHumans() }}</span>
<span class="badge-user"><a href="{{ route('profile', ['username' => $torrentRequest->user->username, 'id' => $torrentRequest->user->id]) }}" title="">{{ $torrentRequest->user->username }}</a></span>
<span class="badge-extra">{{ $torrentRequest->created_at->diffForHumans() }}</span>
</td>
</tr>
<tr>
@@ -178,35 +178,35 @@
<strong>{{ trans('request.claim') }}</strong>
</td>
<td>
@if($request->claimed == null && $request->filled_hash == null)
@if($torrentRequest->claimed == null && $torrentRequest->filled_hash == null)
<button class="btn btn-md btn-success btn-vote-request" data-toggle="modal" data-target="#claim"><i class="fa fa-suitcase">
</i> {{ trans('request.claim') }}
</button>
@elseif($request->filled_hash != null && $request->approved_by == null)
@elseif($torrentRequest->filled_hash != null && $torrentRequest->approved_by == null)
<button class="btn btn-xs btn-info" disabled><i class="fa fa-question-circle"></i>{{ trans('request.pending') }}</button>
@elseif($request->filled_hash != null)
@elseif($torrentRequest->filled_hash != null)
<button class="btn btn-xs btn-success" disabled><i class="fa fa-check-square-o"></i>{{ trans('request.filled') }}</button>
@else @if($requestClaim->anon == 0)
<span class="badge-user">{{ $requestClaim->username }}</span> @if($user->group->is_modo || $requestClaim->username == $user->username)
<a href="{{ route('unclaimRequest', ['id' => $request->id]) }}" class="btn btn-xs btn-danger" role="button" data-toggle="tooltip" title="" data-original-title="{{ trans('request.unclaim') }}">
@else @if($torrentRequestClaim->anon == 0)
<span class="badge-user">{{ $torrentRequestClaim->username }}</span> @if($user->group->is_modo || $torrentRequestClaim->username == $user->username)
<a href="{{ route('unclaimRequest', ['id' => $torrentRequest->id]) }}" class="btn btn-xs btn-danger" role="button" data-toggle="tooltip" title="" data-original-title="{{ trans('request.unclaim') }}">
<span class="icon"><i class="fa fa-times"></i> {{ trans('request.unclaim') }}</span>
</a>
@endif @else
<span class="badge-user">{{ strtoupper(trans('common.anonymous')) }}</span> @if($user->group->is_modo || $requestClaim->username == $user->username)
<a href="{{ route('unclaimRequest', ['id' => $request->id]) }}" class="btn btn-xs btn-danger" role="button" data-toggle="tooltip" title="" data-original-title="{{ trans('request.unclaim') }}">
<span class="badge-user">{{ strtoupper(trans('common.anonymous')) }}</span> @if($user->group->is_modo || $torrentRequestClaim->username == $user->username)
<a href="{{ route('unclaimRequest', ['id' => $torrentRequest->id]) }}" class="btn btn-xs btn-danger" role="button" data-toggle="tooltip" title="" data-original-title="{{ trans('request.unclaim') }}">
<span class="icon"><i class="fa fa-times"></i> {{ trans('request.unclaim') }}</span>
</a>
@endif @endif @endif
</td>
</tr>
@if($request->filled_hash != null && $request->approved_by != null)
@if($torrentRequest->filled_hash != null && $torrentRequest->approved_by != null)
<tr>
<td>
<strong>{{ trans('request.filled-by') }}</strong>
</td>
<td>
<span class="badge-user"><a href="{{ route('profil', ['username' => $request->FillUser->username, 'id' => $request->FillUser->id ]) }}" title="">{{ $request->FillUser->username }}</a></span>
<span class="badge-extra">{{ $request->approved_when->diffForHumans() }}</span>
<span class="badge-user"><a href="{{ route('profile', ['username' => $torrentRequest->FillUser->username, 'id' => $torrentRequest->FillUser->id ]) }}" title="">{{ $torrentRequest->FillUser->username }}</a></span>
<span class="badge-extra">{{ $torrentRequest->approved_when->diffForHumans() }}</span>
</td>
</tr>
<tr>
@@ -214,19 +214,19 @@
<strong>{{ trans('torrent.torrent') }}</strong>
</td>
<td>
<a href="{{ route('torrent', ['slug' => $request->torrent->slug, 'id' => $request->torrent->id]) }}">{{ $request->torrent->name }}</a>
<a href="{{ route('torrent', ['slug' => $torrentRequest->torrent->slug, 'id' => $torrentRequest->torrent->id]) }}">{{ $torrentRequest->torrent->name }}</a>
</td>
</tr>
@endif @if($request->user_id == $user->id && $request->filled_hash != null && $request->approved_by == null || auth()->user()->group->is_modo && $request->filled_hash != null && $request->approved_by == null)
@endif @if($torrentRequest->user_id == $user->id && $torrentRequest->filled_hash != null && $torrentRequest->approved_by == null || auth()->user()->group->is_modo && $torrentRequest->filled_hash != null && $torrentRequest->approved_by == null)
<tr>
<td>
<strong>{{ trans('request.filled-by') }}</strong>
</td>
<td>
<span class="badge-user"><a href="{{ route('profil', ['username' => $request->FillUser->username, 'id' => $request->FillUser->id ]) }}" title="">{{ $request->FillUser->username }}</a></span>
<span class="badge-extra">{{ $request->filled_when->diffForHumans() }}</span>
<span class="badge-extra"><a href="{{ route('approveRequest', ['id' => $request->id]) }}">{{ trans('request.approve') }}</a></span>
<span class="badge-extra"><a href="{{ route('rejectRequest', ['id' => $request->id]) }}">{{ trans('request.reject') }}</a></span>
<span class="badge-user"><a href="{{ route('profile', ['username' => $torrentRequest->FillUser->username, 'id' => $torrentRequest->FillUser->id ]) }}" title="">{{ $torrentRequest->FillUser->username }}</a></span>
<span class="badge-extra">{{ $torrentRequest->filled_when->diffForHumans() }}</span>
<span class="badge-extra"><a href="{{ route('approveRequest', ['id' => $torrentRequest->id]) }}">{{ trans('request.approve') }}</a></span>
<span class="badge-extra"><a href="{{ route('rejectRequest', ['id' => $torrentRequest->id]) }}">{{ trans('request.reject') }}</a></span>
</td>
</tr>
<tr>
@@ -234,7 +234,7 @@
<strong>{{ trans('torrent.torrent') }}</strong>
</td>
<td>
<a href="{{ route('torrent', ['slug' => $request->torrent->slug, 'id' => $request->torrent->id]) }}">{{ $request->torrent->name }}</a>
<a href="{{ route('torrent', ['slug' => $torrentRequest->torrent->slug, 'id' => $torrentRequest->torrent->id]) }}">{{ $torrentRequest->torrent->name }}</a>
</td>
</tr>
@endif
@@ -265,7 +265,7 @@
@foreach($voters as $voter)
<tr>
<td>
<span class="badge-user"><a href="{{ route('profil', ['username' => $voter->user->username, 'id' => $voter->user->id ]) }}" title="">{{ $voter->user->username }}</a></span>
<span class="badge-user"><a href="{{ route('profile', ['username' => $voter->user->username, 'id' => $voter->user->id ]) }}" title="">{{ $voter->user->username }}</a></span>
</td>
<td>
{{ $voter->seedbonus }}
@@ -302,17 +302,17 @@
<div class="media-body">
@if($comment->anon == 1)
<a href="#" class="pull-left">
<img src="{{ url('img/profil.png') }}" alt="{{ $comment->user->username }}" class="img-avatar-48">
<img src="{{ url('img/profile.png') }}" alt="{{ $comment->user->username }}" class="img-avatar-48">
<strong>{{ strtoupper(trans('common.anonymous')) }}</strong></a> @if(auth()->user()->id == $comment->user->id || auth()->user()->group->is_modo)<a href="{{ route('profil', ['username' => $comment->user->username, 'id' => $comment->user->id]) }}">({{ $comment->user->username }})</a>
@endif
@else
<a href="{{ route('profil', array('username' => $comment->user->username, 'id' => $comment->user->id)) }}" class="pull-left">
<a href="{{ route('profile', array('username' => $comment->user->username, 'id' => $comment->user->id)) }}" class="pull-left">
@if($comment->user->image != null)
<img src="{{ url('files/img/' . $comment->user->image) }}" alt="{{ $comment->user->username }}" class="img-avatar-48"></a>
@else
<img src="{{ url('img/profil.png') }}" alt="{{ $comment->user->username }}" class="img-avatar-48"></a>
<img src="{{ url('img/profile.png') }}" alt="{{ $comment->user->username }}" class="img-avatar-48"></a>
@endif
<strong>{{ trans('common.author') }} <a href="{{ route('profil', ['username' => $comment->user->username, 'id' => $comment->user->id]) }}">{{ $comment->user->username }}</a></strong>
<strong>{{ trans('common.author') }} <a href="{{ route('profile', ['username' => $comment->user->username, 'id' => $comment->user->id]) }}">{{ $comment->user->username }}</a></strong>
@endif
<span class="text-muted"><small><em>{{$comment->created_at->diffForHumans() }}</em></small></span>
@if($comment->user_id == auth()->id() || auth()->user()->group->is_modo)
@@ -340,7 +340,7 @@
<!-- Add comment -->
<div class="col-md-12">
{{ Form::open(array('route' => array('comment_request', 'id' => $request->id))) }}
{{ Form::open(array('route' => array('comment_request', 'id' => $torrentRequest->id))) }}
<div class="form-group">
<label for="content">{{ trans('common.your-comment') }}:</label><span class="badge-extra">{{ trans('common.type') }} <strong>:</strong> {{ strtolower(trans('common.for')) }} emoji</span> <span class="badge-extra">BBCode {{ strtolower(trans('common.is-allowed')) }}</span>
<textarea id="content" name="content" cols="30" rows="5" class="form-control"></textarea>
@@ -6,12 +6,12 @@
<button type="button" class="close" data-dismiss="modal" aria-label="{{ trans('common.close') }}"><span aria-hidden="true">&times;</span></button>
<h2><i class="fa fa-thumbs-up"></i> {{ trans('request.vote-that') }}!</h2>
</div>
{{ Form::open(['route' => ['add_votes', 'id' => $request->id], 'method' => 'post', 'role' => 'form']) }}
{{ Form::open(['route' => ['add_votes', 'id' => $torrentRequest->id], 'method' => 'post', 'role' => 'form']) }}
{{ csrf_field() }}
<div class="modal-body">
<p class="text-center">{{ trans('request.enter-bp') }}.</p>
<fieldset>
<input type='hidden' tabindex='3' name='request_id' value='{{ $request->id }}'>
<input type='hidden' tabindex='3' name='request_id' value='{{ $torrentRequest->id }}'>
<input type="number" tabindex="3" name='bonus_value' min='100' value="100">
</fieldset>
<br>
@@ -33,12 +33,12 @@
<button type="button" class="close" data-dismiss="modal" aria-label="{{ trans('common.close') }}"><span aria-hidden="true">&times;</span></button>
<h2><i class="fa fa-thumbs-up"></i> {{ trans('request.fill-request') }}!</h2>
</div>
{{ Form::open(['route' => ['fill_request', 'id' => $request->id], 'method' => 'post', 'role' => 'form']) }}
{{ Form::open(['route' => ['fill_request', 'id' => $torrentRequest->id], 'method' => 'post', 'role' => 'form']) }}
{{ csrf_field() }}
<div class="modal-body">
<p class="text-center">{{ trans('request.enter-hash') }}.</p>
<fieldset>
<input type='hidden' tabindex='3' name='request_id' value='{{ $request->id }}'>
<input type='hidden' tabindex='3' name='request_id' value='{{ $torrentRequest->id }}'>
<input type="text" tabindex="3" name='info_hash' placeholder="{{ trans('request.torrent-hash') }}">
</fieldset>
<br>
@@ -60,13 +60,13 @@
<button type="button" class="close" data-dismiss="modal" aria-label="{{ trans('common.close') }}"><span aria-hidden="true">&times;</span></button>
<h2><i class="fa fa-thumbs-up"></i>{{ trans('request.reset-request') }}!</h2>
</div>
{{ Form::open(['route' => ['resetRequest', 'id' => $request->id], 'method' => 'post', 'role' => 'form']) }}
{{ Form::open(['route' => ['resetRequest', 'id' => $torrentRequest->id], 'method' => 'post', 'role' => 'form']) }}
{{ csrf_field() }}
<div class="modal-body">
<p class="text-center">{{ trans('request.reset-confirmation') }}?</p>
<div class="btns">
<button type="button" class="btn btn-default" data-dismiss="modal">{{ trans('common.cancel') }}</button>
<button type="submit" @if(!$user->group->is_modo || $request->filled_hash == null) disabled @endif class="btn btn-warning">{{ trans('request.reset') }}</button>
<button type="submit" @if(!$user->group->is_modo || $torrentRequest->filled_hash == null) disabled @endif class="btn btn-warning">{{ trans('request.reset') }}</button>
</div>
</div>
{{ Form::close() }}
@@ -82,7 +82,7 @@
<button type="button" class="close" data-dismiss="modal" aria-label="{{ trans('common.close') }}"><span aria-hidden="true">&times;</span></button>
<h2><i class="fa fa-thumbs-up"></i>{{ trans('request.delete') }}</h2>
</div>
{{ Form::open(['route' => ['deleteRequest', 'id' => $request->id], 'method' => 'post', 'role' => 'form']) }}
{{ Form::open(['route' => ['deleteRequest', 'id' => $torrentRequest->id], 'method' => 'post', 'role' => 'form']) }}
{{ csrf_field() }}
<div class="modal-body">
<p class="text-center">{{ trans('request.delete-confirmation') }}?</p>
@@ -91,7 +91,7 @@
</fieldset>
<div class="btns">
<button type="button" class="btn btn-default" data-dismiss="modal">{{ trans('common.cancel') }}</button>
<button type="submit" @if($request->filled_hash != null) disabled @endif class="btn btn-warning">{{ trans('common.delete') }}</button>
<button type="submit" @if($torrentRequest->filled_hash != null) disabled @endif class="btn btn-warning">{{ trans('common.delete') }}</button>
</div>
</div>
{{ Form::close() }}
@@ -107,7 +107,7 @@
<button type="button" class="close" data-dismiss="modal" aria-label="{{ trans('common.close') }}"><span aria-hidden="true">&times;</span></button>
<h2><i class="fa fa-thumbs-up"></i>{{ trans('request.claim') }}</h2>
</div>
{{ Form::open(['route' => ['claimRequest', 'id' => $request->id], 'method' => 'post', 'role' => 'form']) }}
{{ Form::open(['route' => ['claimRequest', 'id' => $torrentRequest->id], 'method' => 'post', 'role' => 'form']) }}
<div class="modal-body">
<p class="text-center">{{ trans('request.claim-as-anon') }}?</p>
<br>
@@ -138,10 +138,10 @@
<div class="modal-dialog modal-lg">
<div class="modal-content">
<meta charset="utf-8">
<title>{{ trans('request.report') }}: {{ $request->name }}</title>
<title>{{ trans('request.report') }}: {{ $torrentRequest->name }}</title>
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="{{ trans('common.close') }}"><span aria-hidden="true">×</span></button>
<h4 class="modal-title" id="myModalLabel">{{ trans('request.report') }}: {{ $request->name }}</h4>
<h4 class="modal-title" id="myModalLabel">{{ trans('request.report') }}: {{ $torrentRequest->name }}</h4>
</div>
<div class="modal-body">
<form class="form-horizontal" role="form" method="POST" action="{{ route('postReport') }}">
@@ -150,8 +150,8 @@
<input id="type" name="type" type="hidden" value="Request">
<label for="file_name" class="col-sm-2 control-label">{{ trans('request.request') }}</label>
<div class="col-sm-10">
<input id="title" name="title" type="hidden" value="{{ $request->name }}">
<p class="form-control-static">{{ $request->name }}</p>
<input id="title" name="title" type="hidden" value="{{ $torrentRequest->name }}">
<p class="form-control-static">{{ $torrentRequest->name }}</p>
</div>
</div>
<div class="form-group">