style: Pint 포맷팅 적용

This commit is contained in:
김보곤
2026-02-25 11:45:01 +09:00
parent 68b1622a4e
commit 9a7c548246
199 changed files with 1420 additions and 1083 deletions

View File

@@ -51,7 +51,7 @@ public function createSalesPartner(array $data, array $documents = []): User
]);
// 3. 역할 할당
if (!empty($data['role_ids'])) {
if (! empty($data['role_ids'])) {
$this->syncRoles($user, $tenantId, $data['role_ids']);
}
@@ -59,7 +59,7 @@ public function createSalesPartner(array $data, array $documents = []): User
$this->assignSalesDepartment($user, $tenantId);
// 4-1. 사업자 정보 저장 (선택)
if (!empty($data['company_name']) || !empty($data['biz_no']) || !empty($data['address'])) {
if (! empty($data['company_name']) || ! empty($data['biz_no']) || ! empty($data['address'])) {
$partnerType = $data['partner_type'] ?? 'individual';
$spData = [
'partner_code' => SalesPartner::generatePartnerCode(),
@@ -84,7 +84,7 @@ public function createSalesPartner(array $data, array $documents = []): User
}
// 5. 첨부 서류 저장
if (!empty($documents)) {
if (! empty($documents)) {
$this->uploadDocuments($user, $tenantId, $documents);
}
@@ -108,7 +108,7 @@ public function updateSalesPartner(User $user, array $data, array $documents = [
];
// 비밀번호 변경 시에만 업데이트
if (!empty($data['password'])) {
if (! empty($data['password'])) {
$updateData['password'] = Hash::make($data['password']);
}
@@ -120,13 +120,13 @@ public function updateSalesPartner(User $user, array $data, array $documents = [
}
// 2-1. 사업자 정보 업데이트
$hasBizInfo = !empty($data['company_name']) || !empty($data['biz_no']) || !empty($data['address']);
$hasBizInfo = ! empty($data['company_name']) || ! empty($data['biz_no']) || ! empty($data['address']);
$existingSp = SalesPartner::where('user_id', $user->id)->first();
$hasPartnerType = !empty($data['partner_type']);
$hasPartnerType = ! empty($data['partner_type']);
if ($hasBizInfo || $existingSp || $hasPartnerType) {
$sp = $existingSp ?? new SalesPartner(['user_id' => $user->id]);
if (!$sp->exists) {
if (! $sp->exists) {
$sp->partner_code = SalesPartner::generatePartnerCode();
$sp->partner_type = $data['partner_type'] ?? 'individual';
$sp->status = 'active';
@@ -151,7 +151,7 @@ public function updateSalesPartner(User $user, array $data, array $documents = [
}
// 3. 새 첨부 서류 저장
if (!empty($documents)) {
if (! empty($documents)) {
$this->uploadDocuments($user, $tenantId, $documents);
}
@@ -194,9 +194,9 @@ public function reject(User $user, int $approverId, string $reason): User
/**
* 역할 위임
*
* @param User $fromUser 역할을 넘기는 파트너
* @param User $toUser 역할을 받는 파트너
* @param string $roleName 위임할 역할 (manager, recruiter 등)
* @param User $fromUser 역할을 넘기는 파트너
* @param User $toUser 역할을 받는 파트너
* @param string $roleName 위임할 역할 (manager, recruiter 등)
*/
public function delegateRole(User $fromUser, User $toUser, string $roleName): bool
{
@@ -208,7 +208,7 @@ public function delegateRole(User $fromUser, User $toUser, string $roleName): bo
->where('name', $roleName)
->first();
if (!$role) {
if (! $role) {
throw new \InvalidArgumentException("역할을 찾을 수 없습니다: {$roleName}");
}
@@ -218,7 +218,7 @@ public function delegateRole(User $fromUser, User $toUser, string $roleName): bo
->where('role_id', $role->id)
->exists();
if (!$hasRole) {
if (! $hasRole) {
throw new \InvalidArgumentException("{$fromUser->name}님이 {$roleName} 역할을 보유하고 있지 않습니다.");
}
@@ -252,7 +252,7 @@ public function assignRole(User $user, string $roleName): bool
->where('name', $roleName)
->first();
if (!$role) {
if (! $role) {
return false;
}
@@ -278,7 +278,7 @@ public function removeRole(User $user, string $roleName): bool
->where('name', $roleName)
->first();
if (!$role) {
if (! $role) {
return false;
}
@@ -338,7 +338,7 @@ public function syncRoles(User $user, int $tenantId, array $roleIds): void
// 제거할 역할 soft delete (새 역할 목록에 없는 것들)
$roleIdsToRemove = array_diff($salesRoleIds, $roleIds);
if (!empty($roleIdsToRemove)) {
if (! empty($roleIdsToRemove)) {
UserRole::where('user_id', $user->id)
->where('tenant_id', $tenantId)
->whereIn('role_id', $roleIdsToRemove)
@@ -379,7 +379,7 @@ public function uploadDocuments(User $user, int $tenantId, array $documents): ar
$uploaded = [];
foreach ($documents as $doc) {
if (!isset($doc['file']) || !$doc['file'] instanceof UploadedFile) {
if (! isset($doc['file']) || ! $doc['file'] instanceof UploadedFile) {
continue;
}
@@ -388,7 +388,7 @@ public function uploadDocuments(User $user, int $tenantId, array $documents): ar
$description = $doc['description'] ?? null;
// 파일 저장
$storedName = Str::uuid() . '.' . $file->getClientOriginalExtension();
$storedName = Str::uuid().'.'.$file->getClientOriginalExtension();
$filePath = "sales-partners/{$user->id}/{$storedName}";
Storage::disk('tenant')->put($filePath, file_get_contents($file));
@@ -448,7 +448,7 @@ public function getSalesPartners(array $filters = [])
->with(['parent', 'userRoles.role', 'salesDocuments', 'salesPartner']);
// 검색
if (!empty($filters['search'])) {
if (! empty($filters['search'])) {
$search = $filters['search'];
$query->where(function ($q) use ($search) {
$q->where('name', 'like', "%{$search}%")
@@ -459,7 +459,7 @@ public function getSalesPartners(array $filters = [])
}
// 역할 필터
if (!empty($filters['role'])) {
if (! empty($filters['role'])) {
$roleName = $filters['role'];
$query->whereHas('userRoles', function ($q) use ($tenantId, $roleName) {
$q->where('tenant_id', $tenantId)
@@ -470,7 +470,7 @@ public function getSalesPartners(array $filters = [])
}
// 승인 상태 필터
if (!empty($filters['approval_status'])) {
if (! empty($filters['approval_status'])) {
$query->where('approval_status', $filters['approval_status']);
}
@@ -480,7 +480,7 @@ public function getSalesPartners(array $filters = [])
}
// 유치자(추천인) 필터 - 현재 로그인한 사용자가 유치한 파트너만
if (!empty($filters['parent_id'])) {
if (! empty($filters['parent_id'])) {
$query->where('parent_id', $filters['parent_id']);
}
@@ -562,10 +562,10 @@ public function getStats(?int $parentId = null): array
'pending' => (clone $baseQuery)->where('approval_status', 'pending')->count(),
'approved' => (clone $baseQuery)->where('approval_status', 'approved')->count(),
'sales' => (clone $baseQuery)
->whereHas('userRoles.role', fn($q) => $q->where('name', 'sales'))
->whereHas('userRoles.role', fn ($q) => $q->where('name', 'sales'))
->count(),
'manager' => (clone $baseQuery)
->whereHas('userRoles.role', fn($q) => $q->where('name', 'manager'))
->whereHas('userRoles.role', fn ($q) => $q->where('name', 'manager'))
->count(),
];
}
@@ -626,6 +626,7 @@ public function getAllDescendants(User $user, int $maxDepth = 10): array
{
$descendants = [];
$this->collectDescendants($user, $descendants, 1, $maxDepth);
return $descendants;
}