Refactor domain grouping in domains API controller
This commit is contained in:
parent
7a21312daf
commit
5e2afd4b4d
@ -48,7 +48,12 @@ public function domains(Request $request)
|
||||
}
|
||||
$domains = $domains->groupBy('ip')->map(function ($domain) {
|
||||
return $domain->pluck('domain')->flatten();
|
||||
});
|
||||
})->map(function ($domain, $ip) {
|
||||
return [
|
||||
'ip' => $ip,
|
||||
'domains' => $domain,
|
||||
];
|
||||
})->values();
|
||||
|
||||
return response()->json($domains);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user