diff --git a/app/Http/Controllers/ServerIconController.php b/app/Http/Controllers/ServerIconController.php new file mode 100644 index 000000000..208678b71 --- /dev/null +++ b/app/Http/Controllers/ServerIconController.php @@ -0,0 +1,42 @@ +validate([ + 'icon' => 'nullable|string|max:64', + 'color' => 'nullable|string|max:32', + ]); + + $server = Server::where('id', $serverId) + ->where('user_id', Auth::id()) + ->firstOrFail(); + + $server->user_set_icon = $request->input('icon'); + $server->user_set_icon_color = $request->input('color'); + $server->save(); + + return response()->json(['success' => true]); + } + + // Get the icon and color for a server + public function show($serverId) + { + $server = Server::where('id', $serverId) + ->where('user_id', Auth::id()) + ->firstOrFail(); + + return response()->json([ + 'icon' => $server->user_set_icon, + 'color' => $server->user_set_icon_color, + ]); + } +} diff --git a/extensions/Servers/Proxmox/Http/Controllers/ServerIconController.php b/extensions/Servers/Proxmox/Http/Controllers/ServerIconController.php new file mode 100644 index 000000000..dcaa896e9 --- /dev/null +++ b/extensions/Servers/Proxmox/Http/Controllers/ServerIconController.php @@ -0,0 +1,39 @@ +validate([ + 'icon' => 'nullable|string|max:64', + 'color' => 'nullable|string|max:32', + ]); + + $server = Server::where('id', $serverId) + ->where('user_id', Auth::id()) + ->firstOrFail(); + + $server->user_set_icon = $request->input('icon'); + $server->user_set_icon_color = $request->input('color'); + $server->save(); + + return response()->json(['success' => true]); + } + + public function get($serverId) + { + $server = Server::where('id', $serverId) + ->where('user_id', Auth::id()) + ->firstOrFail(); + return response()->json([ + 'icon' => $server->user_set_icon, + 'color' => $server->user_set_icon_color, + ]); + } +} diff --git a/extensions/Servers/Proxmox/views/overview.blade.php b/extensions/Servers/Proxmox/views/overview.blade.php index c88f31bff..f592aa81a 100644 --- a/extensions/Servers/Proxmox/views/overview.blade.php +++ b/extensions/Servers/Proxmox/views/overview.blade.php @@ -75,6 +75,127 @@