- Change listStates method to accept nullable integer for limit parameter. - Modify TechnitiumDns class to return structured error messages on failure. - Enhance VNC and xterm popup routes with user authorization checks. - Update backups view to improve loading states and add unique keys for dynamic elements. - Refactor cloud-init view to ensure proper data binding and improve user experience. - Add wire:key attributes to various elements in views for better Livewire performance. - Improve error handling and user feedback in the firewall view. - Update server overview and statistics views to handle potential null values gracefully. - Add new migration files to extend database schema with user-set icons and notes for Proxmox nodes.
43 lines
1.2 KiB
PHP
43 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace Paymenter\Extensions\Servers\Proxmox\Http\Controllers;
|
|
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Support\Facades\Auth;
|
|
use Paymenter\Extensions\Servers\Proxmox\Models\Server;
|
|
|
|
class ServerIconController
|
|
{
|
|
public function update(Request $request, $serverId)
|
|
{
|
|
$request->validate([
|
|
'icon' => 'nullable|string|max:64',
|
|
'color' => 'nullable|string|max:32',
|
|
'prefix' => '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->user_set_icon_prefix = $request->input('prefix', 'ri');
|
|
$server->save();
|
|
|
|
return response()->json(['success' => true]);
|
|
}
|
|
|
|
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,
|
|
'prefix' => $server->user_set_icon_prefix ?? 'ri',
|
|
]);
|
|
}
|
|
}
|