refactor: use route model binding for staff cheated torrents

This commit is contained in:
Roardom
2023-06-28 07:37:56 +00:00
parent 0ecc17f366
commit d08a808737
3 changed files with 4 additions and 4 deletions
@@ -64,9 +64,9 @@ class CheatedTorrentController extends Controller
/**
* Reset the balance of a cheated torrent.
*/
public function destroy(int $id): \Illuminate\Http\RedirectResponse
public function destroy(Torrent $cheatedTorrent): \Illuminate\Http\RedirectResponse
{
Torrent::findOrFail($id)->update([
$cheatedTorrent->update([
'balance_offset' => DB::raw('balance * -1'),
]);
@@ -117,7 +117,7 @@
<menu class="data-table__actions">
<li class="data-table__action">
<form
action="{{ route('staff.cheated_torrents.destroy', ['id' => $torrent->id]) }}"
action="{{ route('staff.cheated_torrents.destroy', ['cheatedTorrent' => $torrent]) }}"
method="POST"
>
@csrf
+1 -1
View File
@@ -733,7 +733,7 @@ Route::middleware('language')->group(function (): void {
Route::prefix('cheated-torrents')->group(function (): void {
Route::name('staff.cheated_torrents.')->group(function (): void {
Route::get('/', [App\Http\Controllers\Staff\CheatedTorrentController::class, 'index'])->name('index');
Route::delete('/{id}', [App\Http\Controllers\Staff\CheatedTorrentController::class, 'destroy'])->name('destroy');
Route::delete('/{cheatedTorrent}', [App\Http\Controllers\Staff\CheatedTorrentController::class, 'destroy'])->name('destroy');
Route::delete('/', [App\Http\Controllers\Staff\CheatedTorrentController::class, 'massDestroy'])->name('massDestroy');
});
});