diff --git a/app/Http/Controllers/API/ServerController.php b/app/Http/Controllers/API/ServerController.php index af4e5937..74c2e9f2 100644 --- a/app/Http/Controllers/API/ServerController.php +++ b/app/Http/Controllers/API/ServerController.php @@ -89,6 +89,19 @@ public function update(Request $request) { ], '', Response::HTTP_FORBIDDEN); } + AuditLog::write( + 'server', + 'update', + [ + 'server_id' => $server->id, + 'server_name' => $server->name, + 'server_ip' => $server->ip_address, + 'new_server_name' => $request->name, + 'new_server_ip' => $request->ip_address + ], + "SERVER_UPDATE" + ); + $server->name = $request->name; $server->ip_address = $request->ip_address; $server->save(); @@ -129,6 +142,16 @@ public function delete(Request $request) { ], '', Response::HTTP_FORBIDDEN); } + AuditLog::write( + 'server', + 'delete', + [ + 'server_id' => $server->id, + 'server_name' => $server->name + ], + "SERVER_DELETE" + ); + $server->delete(); return response()->json([