(Update) Graveyard System 🚀

- abilty to cancel a ressurection
- cruddy
This commit is contained in:
HDVinnie
2019-01-25 09:14:37 -05:00
parent 0a00e7b314
commit 69d9f5db79
4 changed files with 31 additions and 7 deletions
+20 -1
View File
@@ -149,7 +149,7 @@ class GraveyardController extends Controller
*
* @return Illuminate\Http\RedirectResponse
*/
public function resurrect(Request $request, $id)
public function store(Request $request, $id)
{
$user = auth()->user();
$torrent = Torrent::findOrFail($id);
@@ -186,4 +186,23 @@ class GraveyardController extends Controller
->with($this->toastr->success('Torrent Resurrection Complete! You will be rewarded automatically once seedtime requirements are met.', 'Yay!', ['options']));
}
}
/**
* Cancel A Ressurection
*
* @param int $id
*
* @return Illuminate\Http\RedirectResponse
*/
public function destroy($id)
{
$user = auth()->user();
$resurrection = Graveyard::findOrFail($id);
abort_unless($user->group->is_modo || $user->id === $resurrection->user_id, 403);
$resurrection->delete();
return redirect()->route('graveyard.index')
->with($this->toastr->success('Ressurection Successfully Canceled!', 'Yay!', ['options']));
}
}
+1 -1
View File
@@ -107,7 +107,7 @@
</p>
<div class="btns">
<form id="resurrect-torrent" role="form" method="POST"
action="{{ route('resurrect', ['torrent_id' => $torrent->id]) }}">
action="{{ route('graveyard.store', ['torrent_id' => $torrent->id]) }}">
@csrf
@if (!$history)
<input hidden="seedtime" name="seedtime" id="seedtime"
+7 -3
View File
@@ -85,9 +85,13 @@
@endif
</td>
<td>
<button class="btn btn-sm btn-danger" @if ($resurrection->rewarded == 1) disabled @endif>
<i class="{{ config('other.font-awesome') }} fa-trash"></i>
</button>
<form action="{{ route('graveyard.destroy', ['id' => $resurrection->id]) }}" method="POST">
@csrf
@method('DELETE')
<button type="submit" class="btn btn-sm btn-danger" @if ($resurrection->rewarded == 1) disabled @endif>
<i class="{{ config('other.font-awesome') }} fa-trash"></i>
</button>
</form>
</td>
</tr>
@endforeach
+3 -2
View File
@@ -295,8 +295,9 @@ Route::group(['middleware' => 'language'], function () {
// Graveyard System
Route::get('/filterGraveyard', 'GraveyardController@faceted');
Route::get('/graveyard', 'GraveyardController@index')->name('graveyard');
Route::post('/graveyard/{id}', 'GraveyardController@resurrect')->name('resurrect');
Route::get('/graveyard', 'GraveyardController@index')->name('graveyard.index');
Route::post('/graveyard/{id}', 'GraveyardController@store')->name('graveyard.store');
Route::delete('/graveyard/{id}', 'GraveyardController@destroy')->name('graveyard.destroy');
// Notifications System
Route::get('/notifications', 'NotificationController@get')->name('get_notifications');