diff --git a/app/Http/Controllers/Admin/ServersController.php b/app/Http/Controllers/Admin/ServersController.php index a187c8922..a12d00444 100644 --- a/app/Http/Controllers/Admin/ServersController.php +++ b/app/Http/Controllers/Admin/ServersController.php @@ -392,10 +392,10 @@ class ServersController extends Controller * * @throws \Throwable */ - public function addMount(Server $server, Mount $mount) + public function addMount(Request $request, Server $server) { $mountServer = (new MountServer())->forceFill([ - 'mount_id' => $mount->id, + 'mount_id' => $request->input('mount_id'), 'server_id' => $server->id, ]); diff --git a/resources/views/admin/servers/view/mounts.blade.php b/resources/views/admin/servers/view/mounts.blade.php index a34823169..36ca98ddc 100644 --- a/resources/views/admin/servers/view/mounts.blade.php +++ b/resources/views/admin/servers/view/mounts.blade.php @@ -48,9 +48,9 @@ -
+ {!! csrf_field() !!} - +
@@ -60,7 +60,7 @@ -
+ @method('DELETE') {!! csrf_field() !!} diff --git a/routes/admin.php b/routes/admin.php index 055c84a4a..4c6732e76 100644 --- a/routes/admin.php +++ b/routes/admin.php @@ -124,7 +124,7 @@ Route::group(['prefix' => 'servers'], function () { Route::post('/view/{server:id}/build', [Admin\ServersController::class, 'updateBuild']); Route::post('/view/{server:id}/startup', [Admin\ServersController::class, 'saveStartup']); Route::post('/view/{server:id}/database', [Admin\ServersController::class, 'newDatabase']); - Route::post('/view/{server:id}/mounts/{mount:id}', [Admin\ServersController::class, 'addMount'])->name('admin.servers.view.mounts.toggle'); + Route::post('/view/{server:id}/mounts', [Admin\ServersController::class, 'addMount'])->name('admin.servers.view.mounts.store'); Route::post('/view/{server:id}/manage/toggle', [Admin\ServersController::class, 'toggleInstall'])->name('admin.servers.view.manage.toggle'); Route::post('/view/{server:id}/manage/suspension', [Admin\ServersController::class, 'manageSuspension'])->name('admin.servers.view.manage.suspension'); Route::post('/view/{server:id}/manage/reinstall', [Admin\ServersController::class, 'reinstallServer'])->name('admin.servers.view.manage.reinstall'); @@ -135,7 +135,8 @@ Route::group(['prefix' => 'servers'], function () { Route::patch('/view/{server:id}/database', [Admin\ServersController::class, 'resetDatabasePassword']); Route::delete('/view/{server:id}/database/{database:id}/delete', [Admin\ServersController::class, 'deleteDatabase'])->name('admin.servers.view.database.delete'); - Route::delete('/view/{server:id}/mounts/{mount:id}', [Admin\ServersController::class, 'deleteMount']); + Route::delete('/view/{server:id}/mounts/{mount:id}', [Admin\ServersController::class, 'deleteMount']) + ->name('admin.servers.view.mounts.delete'); }); /*