Assorted model code updates.
This commit is contained in:
parent
ba175e6b55
commit
efef356870
|
@ -112,10 +112,8 @@ class NodesController extends Controller
|
||||||
public function getView(Request $request, $id)
|
public function getView(Request $request, $id)
|
||||||
{
|
{
|
||||||
$node = Models\Node::with(
|
$node = Models\Node::with(
|
||||||
'servers.user',
|
'servers.user', 'servers.service',
|
||||||
'servers.service',
|
'servers.allocations', 'location'
|
||||||
'servers.allocations',
|
|
||||||
'location'
|
|
||||||
)->findOrFail($id);
|
)->findOrFail($id);
|
||||||
$node->setRelation('allocations', $node->allocations()->paginate(40));
|
$node->setRelation('allocations', $node->allocations()->paginate(40));
|
||||||
|
|
||||||
|
@ -131,20 +129,12 @@ class NodesController extends Controller
|
||||||
try {
|
try {
|
||||||
$node = new NodeRepository;
|
$node = new NodeRepository;
|
||||||
$node->update($id, $request->only([
|
$node->update($id, $request->only([
|
||||||
'name',
|
'name', 'location', 'public',
|
||||||
'location',
|
'fqdn', 'scheme', 'memory',
|
||||||
'public',
|
'memory_overallocate', 'disk',
|
||||||
'fqdn',
|
'disk_overallocate', 'upload_size',
|
||||||
'scheme',
|
'daemonBase', 'daemonSFTP',
|
||||||
'memory',
|
'daemonListen', 'reset_secret',
|
||||||
'memory_overallocate',
|
|
||||||
'disk',
|
|
||||||
'disk_overallocate',
|
|
||||||
'upload_size',
|
|
||||||
'daemonBase',
|
|
||||||
'daemonSFTP',
|
|
||||||
'daemonListen',
|
|
||||||
'reset_secret',
|
|
||||||
]));
|
]));
|
||||||
Alert::success('Successfully update this node\'s information. If you changed any daemon settings you will need to restart it now.')->flash();
|
Alert::success('Successfully update this node\'s information. If you changed any daemon settings you will need to restart it now.')->flash();
|
||||||
|
|
||||||
|
|
|
@ -73,12 +73,8 @@ class PackController extends Controller
|
||||||
try {
|
try {
|
||||||
$repo = new Pack;
|
$repo = new Pack;
|
||||||
$pack = $repo->create($request->only([
|
$pack = $repo->create($request->only([
|
||||||
'name',
|
'name', 'version', 'description',
|
||||||
'version',
|
'option', 'selectable', 'visible',
|
||||||
'description',
|
|
||||||
'option',
|
|
||||||
'selectable',
|
|
||||||
'visible',
|
|
||||||
'file_upload',
|
'file_upload',
|
||||||
]));
|
]));
|
||||||
Alert::success('Successfully created new service!')->flash();
|
Alert::success('Successfully created new service!')->flash();
|
||||||
|
@ -128,12 +124,8 @@ class PackController extends Controller
|
||||||
try {
|
try {
|
||||||
$repo = new Pack;
|
$repo = new Pack;
|
||||||
$repo->update($id, $request->only([
|
$repo->update($id, $request->only([
|
||||||
'name',
|
'name', 'version', 'description',
|
||||||
'version',
|
'option', 'selectable', 'visible',
|
||||||
'description',
|
|
||||||
'option',
|
|
||||||
'selectable',
|
|
||||||
'visible',
|
|
||||||
]));
|
]));
|
||||||
Alert::success('Service pack has been successfully updated.')->flash();
|
Alert::success('Service pack has been successfully updated.')->flash();
|
||||||
} catch (DisplayValidationException $ex) {
|
} catch (DisplayValidationException $ex) {
|
||||||
|
|
|
@ -279,13 +279,9 @@ class ServersController extends Controller
|
||||||
try {
|
try {
|
||||||
$server = new ServerRepository;
|
$server = new ServerRepository;
|
||||||
$server->changeBuild($id, $request->only([
|
$server->changeBuild($id, $request->only([
|
||||||
'default',
|
'default', 'add_additional',
|
||||||
'add_additional',
|
'remove_additional', 'memory',
|
||||||
'remove_additional',
|
'swap', 'io', 'cpu',
|
||||||
'memory',
|
|
||||||
'swap',
|
|
||||||
'io',
|
|
||||||
'cpu',
|
|
||||||
]));
|
]));
|
||||||
Alert::success('Server details were successfully updated.')->flash();
|
Alert::success('Server details were successfully updated.')->flash();
|
||||||
} catch (DisplayValidationException $ex) {
|
} catch (DisplayValidationException $ex) {
|
||||||
|
@ -377,9 +373,7 @@ class ServersController extends Controller
|
||||||
try {
|
try {
|
||||||
$repo = new DatabaseRepository;
|
$repo = new DatabaseRepository;
|
||||||
$repo->create($id, $request->only([
|
$repo->create($id, $request->only([
|
||||||
'db_server',
|
'db_server', 'database', 'remote',
|
||||||
'database',
|
|
||||||
'remote',
|
|
||||||
]));
|
]));
|
||||||
Alert::success('Added new database to this server.')->flash();
|
Alert::success('Added new database to this server.')->flash();
|
||||||
} catch (DisplayValidationException $ex) {
|
} catch (DisplayValidationException $ex) {
|
||||||
|
|
|
@ -59,11 +59,8 @@ class ServiceController extends Controller
|
||||||
try {
|
try {
|
||||||
$repo = new ServiceRepository\Service;
|
$repo = new ServiceRepository\Service;
|
||||||
$service = $repo->create($request->only([
|
$service = $repo->create($request->only([
|
||||||
'name',
|
'name', 'description', 'file',
|
||||||
'description',
|
'executable', 'startup',
|
||||||
'file',
|
|
||||||
'executable',
|
|
||||||
'startup',
|
|
||||||
]));
|
]));
|
||||||
Alert::success('Successfully created new service!')->flash();
|
Alert::success('Successfully created new service!')->flash();
|
||||||
|
|
||||||
|
@ -92,11 +89,8 @@ class ServiceController extends Controller
|
||||||
try {
|
try {
|
||||||
$repo = new ServiceRepository\Service;
|
$repo = new ServiceRepository\Service;
|
||||||
$repo->update($service, $request->only([
|
$repo->update($service, $request->only([
|
||||||
'name',
|
'name', 'description', 'file',
|
||||||
'description',
|
'executable', 'startup',
|
||||||
'file',
|
|
||||||
'executable',
|
|
||||||
'startup',
|
|
||||||
]));
|
]));
|
||||||
Alert::success('Successfully updated this service.')->flash();
|
Alert::success('Successfully updated this service.')->flash();
|
||||||
} catch (DisplayValidationException $ex) {
|
} catch (DisplayValidationException $ex) {
|
||||||
|
@ -134,9 +128,7 @@ class ServiceController extends Controller
|
||||||
$option = Models\ServiceOptions::with('service', 'variables')->findOrFail($option);
|
$option = Models\ServiceOptions::with('service', 'variables')->findOrFail($option);
|
||||||
$option->setRelation('servers', $option->servers()->with('user')->paginate(25));
|
$option->setRelation('servers', $option->servers()->with('user')->paginate(25));
|
||||||
|
|
||||||
return view('admin.services.options.view', [
|
return view('admin.services.options.view', ['option' => $option]);
|
||||||
'option' => $option,
|
|
||||||
]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function postOption(Request $request, $service, $option)
|
public function postOption(Request $request, $service, $option)
|
||||||
|
@ -144,12 +136,8 @@ class ServiceController extends Controller
|
||||||
try {
|
try {
|
||||||
$repo = new ServiceRepository\Option;
|
$repo = new ServiceRepository\Option;
|
||||||
$repo->update($option, $request->only([
|
$repo->update($option, $request->only([
|
||||||
'name',
|
'name', 'description', 'tag',
|
||||||
'description',
|
'executable', 'docker_image', 'startup',
|
||||||
'tag',
|
|
||||||
'executable',
|
|
||||||
'docker_image',
|
|
||||||
'startup',
|
|
||||||
]));
|
]));
|
||||||
Alert::success('Option settings successfully updated.')->flash();
|
Alert::success('Option settings successfully updated.')->flash();
|
||||||
} catch (DisplayValidationException $ex) {
|
} catch (DisplayValidationException $ex) {
|
||||||
|
@ -227,14 +215,9 @@ class ServiceController extends Controller
|
||||||
try {
|
try {
|
||||||
$repo = new ServiceRepository\Variable;
|
$repo = new ServiceRepository\Variable;
|
||||||
$repo->create($option, $request->only([
|
$repo->create($option, $request->only([
|
||||||
'name',
|
'name', 'description', 'env_variable',
|
||||||
'description',
|
'default_value', 'user_viewable',
|
||||||
'env_variable',
|
'user_editable', 'required', 'regex',
|
||||||
'default_value',
|
|
||||||
'user_viewable',
|
|
||||||
'user_editable',
|
|
||||||
'required',
|
|
||||||
'regex',
|
|
||||||
]));
|
]));
|
||||||
Alert::success('Successfully added new variable to this option.')->flash();
|
Alert::success('Successfully added new variable to this option.')->flash();
|
||||||
|
|
||||||
|
@ -311,10 +294,7 @@ class ServiceController extends Controller
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$repo = new ServiceRepository\Service;
|
$repo = new ServiceRepository\Service;
|
||||||
$repo->updateFile($serviceId, $request->only([
|
$repo->updateFile($serviceId, $request->only(['file', 'contents']));
|
||||||
'file',
|
|
||||||
'contents',
|
|
||||||
]));
|
|
||||||
|
|
||||||
return response('', 204);
|
return response('', 204);
|
||||||
} catch (DisplayException $ex) {
|
} catch (DisplayException $ex) {
|
||||||
|
|
|
@ -88,12 +88,8 @@ class UserController extends Controller
|
||||||
try {
|
try {
|
||||||
$user = new UserRepository;
|
$user = new UserRepository;
|
||||||
$userid = $user->create($request->only([
|
$userid = $user->create($request->only([
|
||||||
'email',
|
'email', 'password', 'name_first',
|
||||||
'password',
|
'name_last', 'username', 'root_admin',
|
||||||
'name_first',
|
|
||||||
'name_last',
|
|
||||||
'username',
|
|
||||||
'root_admin',
|
|
||||||
]));
|
]));
|
||||||
Alert::success('Account has been successfully created.')->flash();
|
Alert::success('Account has been successfully created.')->flash();
|
||||||
|
|
||||||
|
@ -113,12 +109,8 @@ class UserController extends Controller
|
||||||
try {
|
try {
|
||||||
$repo = new UserRepository;
|
$repo = new UserRepository;
|
||||||
$repo->update($user, $request->only([
|
$repo->update($user, $request->only([
|
||||||
'email',
|
'email', 'password', 'name_first',
|
||||||
'password',
|
'name_last', 'username', 'root_admin',
|
||||||
'name_first',
|
|
||||||
'name_last',
|
|
||||||
'username',
|
|
||||||
'root_admin',
|
|
||||||
]));
|
]));
|
||||||
Alert::success('User account was successfully updated.')->flash();
|
Alert::success('User account was successfully updated.')->flash();
|
||||||
} catch (DisplayValidationException $ex) {
|
} catch (DisplayValidationException $ex) {
|
||||||
|
|
Loading…
Reference in New Issue