Fix mounting behavior to work correctly when adding to a server

This commit is contained in:
DaneEveritt 2022-05-30 11:33:42 -04:00
parent dbc9846320
commit 4213775b5c
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
3 changed files with 8 additions and 7 deletions

View file

@ -392,10 +392,10 @@ class ServersController extends Controller
* *
* @throws \Throwable * @throws \Throwable
*/ */
public function addMount(Server $server, Mount $mount) public function addMount(Request $request, Server $server)
{ {
$mountServer = (new MountServer())->forceFill([ $mountServer = (new MountServer())->forceFill([
'mount_id' => $mount->id, 'mount_id' => $request->input('mount_id'),
'server_id' => $server->id, 'server_id' => $server->id,
]); ]);

View file

@ -48,9 +48,9 @@
</td> </td>
<td class="col-sm-1 middle"> <td class="col-sm-1 middle">
<form action="{{ route('admin.servers.view.mounts.toggle', [ 'server' => $server->id, 'mount' => $mount->id ]) }}" method="POST"> <form action="{{ route('admin.servers.view.mounts.store', [ 'server' => $server->id ]) }}" method="POST">
{!! csrf_field() !!} {!! csrf_field() !!}
<input type="hidden" value="{{ $mount->id }}" name="mount_id" />
<button type="submit" class="btn btn-xs btn-success"><i class="fa fa-plus"></i></button> <button type="submit" class="btn btn-xs btn-success"><i class="fa fa-plus"></i></button>
</form> </form>
</td> </td>
@ -60,7 +60,7 @@
</td> </td>
<td class="col-sm-1 middle"> <td class="col-sm-1 middle">
<form action="{{ route('admin.servers.view.mounts.toggle', [ 'server' => $server->id, 'mount' => $mount->id ]) }}" method="POST"> <form action="{{ route('admin.servers.view.mounts.delete', [ 'server' => $server->id, 'mount' => $mount->id ]) }}" method="POST">
@method('DELETE') @method('DELETE')
{!! csrf_field() !!} {!! csrf_field() !!}

View file

@ -124,7 +124,7 @@ Route::group(['prefix' => 'servers'], function () {
Route::post('/view/{server:id}/build', [Admin\ServersController::class, 'updateBuild']); 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}/startup', [Admin\ServersController::class, 'saveStartup']);
Route::post('/view/{server:id}/database', [Admin\ServersController::class, 'newDatabase']); 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/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/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'); 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::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}/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');
}); });
/* /*