mirror of
https://github.com/HDInnovations/UNIT3D-Community-Edition.git
synced 2026-04-28 06:20:42 -05:00
Search user's uploads table
This commit is contained in:
@@ -672,4 +672,24 @@ class UserController extends Controller
|
||||
return back()->with(Toastr::error('You Are Not Authorized To Perform This Action!', 'Error 403', ['options']));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Search A User's Uploads
|
||||
*
|
||||
* @param $username
|
||||
* @param $id
|
||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
*/
|
||||
public function myUploadsSearch(Request $request, $username, $id)
|
||||
{
|
||||
$user = User::findOrFail($id);
|
||||
if (auth()->user()->group->is_modo || auth()->user()->id == $user->id) {
|
||||
$torrents = Torrent::withAnyStatus()->sortable(['created_at' => 'desc'])->where('user_id', $user->id)->where([
|
||||
['name', 'like', '%' . $request->input('name') . '%'],
|
||||
])->paginate(50);
|
||||
return view('user.uploads', ['user' => $user, 'torrents' => $torrents]);
|
||||
} else {
|
||||
return back()->with(Toastr::error('You Are Not Authorized To Perform This Action!', 'Error 403', ['options']));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,6 +17,19 @@
|
||||
<div class="container-fluid">
|
||||
<h1 class="title">Uploads Table</h1>
|
||||
<div class="block">
|
||||
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<div class="input-group pull-right">
|
||||
<form role="form" method="GET" action="{{ route('myuploadssearch', ['username' => $user->username, 'id' => $user->id]) }}">
|
||||
@csrf
|
||||
<input type="text" name="name" id="name" class="form-control"
|
||||
placeholder="Search...">
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Uploads -->
|
||||
<div class="table-responsive">
|
||||
<table class="table table-condensed table-striped table-bordered">
|
||||
|
||||
@@ -234,6 +234,8 @@ Route::group(['middleware' => 'language'], function () {
|
||||
Route::get('/{username}.{id}/myuploads', 'UserController@myUploads')->name('myuploads');
|
||||
Route::get('/{username}.{id}/myactive', 'UserController@myActive')->name('myactive');
|
||||
Route::get('/{username}.{id}/myhistory', 'UserController@myHistory')->name('myhistory');
|
||||
|
||||
Route::get('/{username}.{id}/myuploadssearch', 'UserController@myUploadsSearch')->name('myuploadssearch');
|
||||
|
||||
// User Wishlist
|
||||
Route::get('/wishlist/{uid}', 'WishController@index')->name('wishlist');
|
||||
|
||||
Reference in New Issue
Block a user