Refactor resource retrieval in API controller

This commit is contained in:
Andras Bacsai 2024-03-07 11:37:56 +01:00
parent c7693d0ec3
commit db24828a5a

View File

@ -18,11 +18,9 @@ public function resources(Request $request)
$resources = collect();
$resources->push($projects->pluck('applications')->flatten());
$resources->push($projects->pluck('services')->flatten());
$resources->push($projects->pluck('postgresqls')->flatten());
$resources->push($projects->pluck('redis')->flatten());
$resources->push($projects->pluck('mongodbs')->flatten());
$resources->push($projects->pluck('mysqls')->flatten());
$resources->push($projects->pluck('mariadbs')->flatten());
foreach (collect(DATABASE_TYPES) as $db) {
$resources->push($projects->pluck(str($db)->plural(2))->flatten());
}
$resources = $resources->flatten();
return response()->json($resources);
}