Add mount_server table, fix wrong field type on other many to many tables, add routes for mounting and unmounting mounts on a server, finish server admin mounts page

This commit is contained in:
Matthew Penner 2020-05-21 14:23:12 -06:00
parent a0900b8b94
commit 0eb29dac9c
8 changed files with 119 additions and 22 deletions

View file

@ -378,4 +378,34 @@ class ServersController extends Controller
return response('', 204);
}
/**
* Add a mount to a server.
*
* @param Server $server
* @param int $mount_id
* @return \Illuminate\Http\RedirectResponse
*/
public function addMount(Server $server, int $mount_id)
{
$server->mounts()->attach($mount_id);
$this->alert->success('Mount was added successfully.')->flash();
return redirect()->route('admin.servers.view.mounts', $server->id);
}
/**
* Remove a mount from a server.
*
* @param Server $server
* @param int $mount_id
* @return \Illuminate\Http\RedirectResponse
*/
public function deleteMount(Server $server, int $mount_id)
{
$server->mounts()->detach($mount_id);
$this->alert->success('Mount was removed successfully.')->flash();
return redirect()->route('admin.servers.view.mounts', $server->id);
}
}