<?php

namespace App\Http\Controllers;

use App\Models\ConfServerLicense;
use Illuminate\Http\Request;

class ServerLicenseController extends Controller
{
    public function index() {
        $menu = 'ServerLicense';
        $currentContent = 'ServerLicense';
        return view('home'  ,compact('menu', 'currentContent'));
    }
    public function getAllServerKey()
    {
        $serverLicenses = ConfServerLicense::select('ID', 'SNKEY')->get();

        $formattedserverLicenses = [];

        foreach ($serverLicenses as $license) {
            $formattedserverLicenses[] = [
                'id' => $license->ID,
                'name' => $license->SNKEY,
            ];
        }
        return response()->json(['serverLicenses' => $formattedserverLicenses]);
    }
}
