Changeset View
Changeset View
Standalone View
Standalone View
src/app/Http/Controllers/API/V4/UsersController.php
Show First 20 Lines • Show All 237 Lines • ▼ Show 20 Lines | public static function statusInfo(User $user): array | ||||
} | } | ||||
// Check if the user is a controller of his wallet | // Check if the user is a controller of his wallet | ||||
$isController = $user->canDelete($user); | $isController = $user->canDelete($user); | ||||
$hasCustomDomain = $user->wallet()->entitlements() | $hasCustomDomain = $user->wallet()->entitlements() | ||||
->where('entitleable_type', Domain::class) | ->where('entitleable_type', Domain::class) | ||||
->count() > 0; | ->count() > 0; | ||||
// Get user's beta entitlements | // Get user's entitlements titles | ||||
$betaSKUs = $user->entitlements()->select('skus.title') | $skus = $user->entitlements()->select('skus.title') | ||||
->join('skus', 'skus.id', '=', 'entitlements.sku_id') | ->join('skus', 'skus.id', '=', 'entitlements.sku_id') | ||||
->where('handler_class', 'like', 'App\\\\Handlers\\\\Beta\\\\%') | |||||
->get() | ->get() | ||||
->pluck('title') | ->pluck('title') | ||||
->sort() | |||||
->unique() | ->unique() | ||||
->values() | |||||
->all(); | ->all(); | ||||
return [ | return [ | ||||
'betaSKUs' => $betaSKUs, | 'skus' => $skus, | ||||
// TODO: This will change when we enable all users to create domains | // TODO: This will change when we enable all users to create domains | ||||
'enableDomains' => $isController && $hasCustomDomain, | 'enableDomains' => $isController && $hasCustomDomain, | ||||
'enableUsers' => $isController, | 'enableUsers' => $isController, | ||||
'enableWallets' => $isController, | 'enableWallets' => $isController, | ||||
'process' => $process, | 'process' => $process, | ||||
'processState' => $state, | 'processState' => $state, | ||||
'isReady' => $all === $checked, | 'isReady' => $all === $checked, | ||||
]; | ]; | ||||
▲ Show 20 Lines • Show All 556 Lines • Show Last 20 Lines |