Changeset View
Changeset View
Standalone View
Standalone View
src/app/Http/Controllers/API/V4/DomainsController.php
Show All 19 Lines | |||||
* Return a list of domains owned by the current user | * Return a list of domains owned by the current user | ||||
* | * | ||||
* @return \Illuminate\Http\JsonResponse | * @return \Illuminate\Http\JsonResponse | ||||
*/ | */ | ||||
public function index() | public function index() | ||||
{ | { | ||||
$user = $this->guard()->user(); | $user = $this->guard()->user(); | ||||
$list = \collect($user->domains()) | $list = $user->domains(true, false) | ||||
->filter(function ($domain) { | ->orderBy('namespace') | ||||
return !$domain->isPublic(); | ->get() | ||||
}) | |||||
->map(function ($domain) { | ->map(function ($domain) { | ||||
return $this->objectToClient($domain); | return $this->objectToClient($domain); | ||||
}) | }) | ||||
->sortBy('namespace') | |||||
->values() | |||||
->all(); | ->all(); | ||||
return response()->json($list); | return response()->json($list); | ||||
} | } | ||||
/** | /** | ||||
* Show the form for creating a new domain. | * Show the form for creating a new domain. | ||||
* | * | ||||
▲ Show 20 Lines • Show All 419 Lines • Show Last 20 Lines |