<?php

namespace App\Http\Controllers;

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

class ServerLicenseController extends Controller
{
    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]);
    }
}
