Files
Virtnet.bond/extensions/Servers/Proxmox/Http/Controllers/ServerIconController.php
Joseph.Rawlings af62a16354 Refactor modal close behavior and improve styling
- Changed modal close event from `@click.away` to `@click.self` for better control over closing modals.
- Updated various modal button styles for consistency and improved accessibility.
- Adjusted transition durations for modal animations to enhance user experience.
- Added aria-labels to close buttons for better screen reader support.
2026-02-23 20:02:41 -05:00

50 lines
1.5 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|regex:/^[a-zA-Z0-9#\-\/]+$/',
'prefix' => 'nullable|string|max:32|regex:/^[a-zA-Z0-9\-]+$/',
]);
try {
$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]);
} catch (\Exception $e) {
return response()->json([
'success' => false,
'error' => 'Failed to update icon.',
], 500);
}
}
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',
]);
}
}