diff --git a/app/Http/Controllers/Admin/ServersController.php b/app/Http/Controllers/Admin/ServersController.php index 324e7c3b0..363737159 100644 --- a/app/Http/Controllers/Admin/ServersController.php +++ b/app/Http/Controllers/Admin/ServersController.php @@ -420,27 +420,19 @@ class ServersController extends Controller * * @param Server $server * @param \Pterodactyl\Models\Mount $mount - * * @return \Illuminate\Http\RedirectResponse - * @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException|\Throwable + * + * @throws \Throwable */ public function addMount(Server $server, Mount $mount) { - $mountServer = new MountServer; - $mountServer->mount_id = $mount->id; - $mountServer->server_id = $server->id; + $mountServer = (new MountServer)->forceFill([ + 'mount_id' => $mount->id, + 'server_id' => $server->id, + ]); + $mountServer->saveOrFail(); - $data = $this->serverConfigurationStructureService->handle($server); - - try { - $this->daemonServerRepository - ->setServer($server) - ->update(Arr::only($data, ['mounts'])); - } catch (RequestException $exception) { - throw new DaemonConnectionException($exception); - } - $this->alert->success('Mount was added successfully.')->flash(); return redirect()->route('admin.servers.view.mounts', $server->id); @@ -452,24 +444,11 @@ class ServersController extends Controller * @param Server $server * @param \Pterodactyl\Models\Mount $mount * @return \Illuminate\Http\RedirectResponse - * - * @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException - * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ public function deleteMount(Server $server, Mount $mount) { MountServer::where('mount_id', $mount->id)->where('server_id', $server->id)->delete(); - $data = $this->serverConfigurationStructureService->handle($server); - - try { - $this->daemonServerRepository - ->setServer($server) - ->update(Arr::only($data, ['mounts'])); - } catch (RequestException $exception) { - throw new DaemonConnectionException($exception); - } - $this->alert->success('Mount was removed successfully.')->flash(); return redirect()->route('admin.servers.view.mounts', $server->id);