Code Styling
This commit is contained in:
@@ -3,8 +3,6 @@
|
||||
namespace App\Domains\Admin\Controllers;
|
||||
|
||||
use App\Enumerations\UserRole;
|
||||
use App\Models\Tenant;
|
||||
use App\Models\User;
|
||||
use App\Scopes\CommonController;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
@@ -13,13 +11,12 @@ class UserDetailGetController extends CommonController
|
||||
{
|
||||
public function __invoke(int $id, Request $request): JsonResponse
|
||||
{
|
||||
$user = User::findOrFail($id);
|
||||
$user = $this->adminUsers->findById($id);
|
||||
|
||||
$userData = $user->toArray();
|
||||
|
||||
unset($userData['password'], $userData['remember_token'], $userData['activation_token'], $userData['activation_token_expires_at']);
|
||||
|
||||
$tenantNames = Tenant::pluck('name', 'slug');
|
||||
$tenantNames = $this->adminTenants->getTenantNames();
|
||||
$userData['nicename'] = $user->getNicename();
|
||||
$userData['fullname'] = $user->getFullName();
|
||||
$userData['local_group_name'] = $tenantNames[$user->local_group] ?? $user->local_group;
|
||||
@@ -29,7 +26,7 @@ class UserDetailGetController extends CommonController
|
||||
'isOwnUser' => auth()->id() === $user->id,
|
||||
'isLvTenant' => $this->tenant->slug === 'lv',
|
||||
'userRoles' => UserRole::all()->map(fn($role) => ['slug' => $role->slug, 'name' => $role->name]),
|
||||
'localGroups' => Tenant::where('is_active_local_group', true)->get()->map(fn($t) => ['slug' => $t->slug, 'name' => $t->name]),
|
||||
'localGroups' => $this->adminTenants->getActiveLocalGroups()->map(fn($t) => ['slug' => $t->slug, 'name' => $t->name]),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user