27 lines
750 B
PHP
27 lines
750 B
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Api;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use App\Models\Gpu;
|
|
use Illuminate\Http\JsonResponse;
|
|
|
|
class GpuCatalogController extends Controller
|
|
{
|
|
/**
|
|
* The canonical GPU list, authenticated for the CLI. One GPU, one
|
|
* identity — this is the list the CLI's picker and normalizer trust.
|
|
*/
|
|
public function index(): JsonResponse
|
|
{
|
|
return response()->json([
|
|
'gpus' => Gpu::query()
|
|
->where('active', true)
|
|
->orderBy('vendor')
|
|
->orderBy('name')
|
|
->get(['name', 'vendor'])
|
|
->map(fn (Gpu $gpu) => ['name' => $gpu->name, 'vendor' => $gpu->vendor])
|
|
->all(),
|
|
]);
|
|
}
|
|
}
|