feat: HR 모델 userProfile 관계 추가 및 서비스 개선
## 모델 개선 - Leave: userProfile relation 추가 - Salary: userProfile relation 추가 - TenantUserProfile: department, position 관계 및 label accessor 추가 ## 서비스 개선 - LeaveService: userProfile eager loading 추가 - SalaryService: 사원 정보 조회 개선 - CardService: 관계 정리 및 개선 - AttendanceService: 조회 기능 개선 ## 시더 - DummySalarySeeder 추가 - DummyCardSeeder 멀티테넌트 지원 개선 - DummyDataSeeder에 급여 시더 등록 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
use App\Traits\BelongsToTenant;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasOne;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
/**
|
||||
@@ -140,6 +141,16 @@ public function updater(): BelongsTo
|
||||
return $this->belongsTo(User::class, 'updated_by');
|
||||
}
|
||||
|
||||
/**
|
||||
* 신청자 프로필 (테넌트별)
|
||||
* 주의: eager loading 시 constrain 필요
|
||||
* ->with(['userProfile' => fn($q) => $q->where('tenant_id', $tenantId)])
|
||||
*/
|
||||
public function userProfile(): HasOne
|
||||
{
|
||||
return $this->hasOne(TenantUserProfile::class, 'user_id', 'user_id');
|
||||
}
|
||||
|
||||
// =========================================================================
|
||||
// 스코프
|
||||
// =========================================================================
|
||||
|
||||
Reference in New Issue
Block a user