refactor: remove ServerIconController and update related views for server icon handling
This commit is contained in:
@@ -1,42 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Paymenter\Extensions\Servers\Proxmox\Models\Server;
|
||||
|
||||
class ServerIconController extends Controller
|
||||
{
|
||||
// Update the icon and color for a server
|
||||
public function update(Request $request, $serverId)
|
||||
{
|
||||
$request->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,
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user