style: Laravel Pint 코드 포맷팅 적용

- PSR-12 스타일 가이드 준수
- 302개 파일 스타일 이슈 자동 수정
- 코드 로직 변경 없음 (포맷팅만)
This commit is contained in:
2025-11-06 17:45:49 +09:00
parent 48e76432ee
commit cc206fdbed
294 changed files with 4476 additions and 2561 deletions

View File

@@ -29,16 +29,18 @@ protected static function resolveRoleNames(int $tenantId, array $params): array
$names = [];
// A) role_names[] 직접
if (!empty($params['role_names']) && is_array($params['role_names'])) {
if (! empty($params['role_names']) && is_array($params['role_names'])) {
foreach ($params['role_names'] as $n) {
if (is_string($n) && $n !== '') $names[] = trim($n);
if (is_string($n) && $n !== '') {
$names[] = trim($n);
}
}
}
// B) role_ids[] → 이름으로 변환
if (!empty($params['role_ids']) && is_array($params['role_ids'])) {
if (! empty($params['role_ids']) && is_array($params['role_ids'])) {
$ids = array_values(array_unique(array_map('intval', $params['role_ids'])));
if (!empty($ids)) {
if (! empty($ids)) {
$rows = Role::query()
->where('tenant_id', $tenantId)
->where('guard_name', self::$guard)
@@ -53,7 +55,7 @@ protected static function resolveRoleNames(int $tenantId, array $params): array
$names = array_values(array_unique(array_filter($names)));
// 존재 확인(필요시 에러 처리 확장 가능)
if (!empty($names)) {
if (! empty($names)) {
$count = Role::query()
->where('tenant_id', $tenantId)
->where('guard_name', self::$guard)
@@ -71,7 +73,7 @@ public static function list(int $userId)
$tenantId = (int) app('tenant_id');
$user = self::loadUserOrError($userId);
if (!$user) {
if (! $user) {
return ['error' => '사용자를 찾을 수 없습니다.', 'code' => 404];
}
@@ -81,7 +83,7 @@ public static function list(int $userId)
$builder = $user->roles()
->where('roles.tenant_id', $tenantId)
->where('roles.guard_name', self::$guard)
->select(['roles.id','roles.tenant_id','roles.name','roles.description','roles.guard_name','roles.created_at','roles.updated_at'])
->select(['roles.id', 'roles.tenant_id', 'roles.name', 'roles.description', 'roles.guard_name', 'roles.created_at', 'roles.updated_at'])
->orderBy('roles.id', 'desc');
return $builder->get();
@@ -93,15 +95,15 @@ public static function grant(int $userId, array $params = [])
$tenantId = (int) app('tenant_id');
$user = self::loadUserOrError($userId);
if (!$user) {
if (! $user) {
return ['error' => '사용자를 찾을 수 없습니다.', 'code' => 404];
}
$v = Validator::make($params, [
'role_names' => 'sometimes|array',
'role_names' => 'sometimes|array',
'role_names.*' => 'string|min:1',
'role_ids' => 'sometimes|array',
'role_ids.*' => 'integer|min:1',
'role_ids' => 'sometimes|array',
'role_ids.*' => 'integer|min:1',
]);
if ($v->fails()) {
return ['error' => $v->errors()->first(), 'code' => 422];
@@ -118,6 +120,7 @@ public static function grant(int $userId, array $params = [])
}
$user->assignRole($names); // teams 컨텍스트 적용됨
return 'success';
}
@@ -127,15 +130,15 @@ public static function revoke(int $userId, array $params = [])
$tenantId = (int) app('tenant_id');
$user = self::loadUserOrError($userId);
if (!$user) {
if (! $user) {
return ['error' => '사용자를 찾을 수 없습니다.', 'code' => 404];
}
$v = Validator::make($params, [
'role_names' => 'sometimes|array',
'role_names' => 'sometimes|array',
'role_names.*' => 'string|min:1',
'role_ids' => 'sometimes|array',
'role_ids.*' => 'integer|min:1',
'role_ids' => 'sometimes|array',
'role_ids.*' => 'integer|min:1',
]);
if ($v->fails()) {
return ['error' => $v->errors()->first(), 'code' => 422];
@@ -152,6 +155,7 @@ public static function revoke(int $userId, array $params = [])
}
$user->removeRole($names); // 배열 허용
return 'success';
}
@@ -161,15 +165,15 @@ public static function sync(int $userId, array $params = [])
$tenantId = (int) app('tenant_id');
$user = self::loadUserOrError($userId);
if (!$user) {
if (! $user) {
return ['error' => '사용자를 찾을 수 없습니다.', 'code' => 404];
}
$v = Validator::make($params, [
'role_names' => 'sometimes|array',
'role_names' => 'sometimes|array',
'role_names.*' => 'string|min:1',
'role_ids' => 'sometimes|array',
'role_ids.*' => 'integer|min:1',
'role_ids' => 'sometimes|array',
'role_ids.*' => 'integer|min:1',
]);
if ($v->fails()) {
return ['error' => $v->errors()->first(), 'code' => 422];
@@ -187,6 +191,7 @@ public static function sync(int $userId, array $params = [])
}
$user->syncRoles($names);
return 'success';
}
}