Skip to content

Commit

Permalink
Merge pull request #956 from dbarzin/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
dbarzin authored Nov 11, 2024
2 parents 1fb5460 + 84bdaa0 commit bc816a0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
12 changes: 6 additions & 6 deletions app/Http/Controllers/API/LogicalServerController.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ public function store(StoreLogicalServerRequest $request)
abort_if(Gate::denies('logical_server_create'), Response::HTTP_FORBIDDEN, '403 Forbidden');

$logicalServer = LogicalServer::create($request->all());
if ($request->has('servers[]')) {
if ($request->has('servers')) {
$logicalServer->servers()->sync($request->input('servers', []));
}
if ($request->has('applications[]')) {
if ($request->has('applications')) {
$logicalServer->applications()->sync($request->input('applications', []));
}
if ($request->has('databases[]')) {
if ($request->has('databases')) {
$logicalServer->databases()->sync($request->input('databases', []));
}

Expand All @@ -52,13 +52,13 @@ public function update(UpdateLogicalServerRequest $request, LogicalServer $logic
abort_if(Gate::denies('logical_server_edit'), Response::HTTP_FORBIDDEN, '403 Forbidden');

$logicalServer->update($request->all());
if ($request->has('servers[]')) {
if ($request->has('servers')) {
$logicalServer->servers()->sync($request->input('servers', []));
}
if ($request->has('applications[]')) {
if ($request->has('applications')) {
$logicalServer->applications()->sync($request->input('applications', []));
}
if ($request->has('databases[]')) {
if ($request->has('databases')) {
$logicalServer->databases()->sync($request->input('databases', []));
}

Expand Down
9 changes: 4 additions & 5 deletions app/Http/Controllers/API/PhysicalServerController.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,17 @@ public function store(StorePhysicalServerRequest $request)
abort_if(Gate::denies('physical_server_create'), Response::HTTP_FORBIDDEN, '403 Forbidden');

$physicalserver = PhysicalServer::create($request->all());
$physicalserver->applications()->sync($request->input('applications', []));
// syncs
// $physicalserver->roles()->sync($request->input('roles', []));
if ($request->has('applications'))
$physicalserver->applications()->sync($request->input('applications', []));

return response()->json($physicalserver, 201);
}

public function show(PhysicalServer $physicalserver)
public function show(PhysicalServer $physicalServer)
{
abort_if(Gate::denies('physical_server_show'), Response::HTTP_FORBIDDEN, '403 Forbidden');

return new PhysicalServerResource($physicalserver);
return new PhysicalServerResource($physicalServer);
}

public function update(UpdatePhysicalServerRequest $request, PhysicalServer $physicalServer)
Expand Down

0 comments on commit bc816a0

Please sign in to comment.