feat: [leaves] 휴가신청 → 전자결재 자동 연동
- LeaveService: 휴가 신청 시 결재 자동 생성+상신 - LeaveService: approveByApproval/rejectByApproval 메서드 추가 - LeaveService: deletePendingLeave 시 연결된 결재 자동 취소 - ApprovalService: 승인/반려/회수/전결 시 휴가 상태 자동 동기화 - Leave 모델: approval_id, approval() 관계 추가 - UI: pending 휴가에 결재 상세 링크 추가, 승인/반려 버튼 제거
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Models\HR;
|
||||
|
||||
use App\Models\Approvals\Approval;
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
@@ -24,6 +25,7 @@ class Leave extends Model
|
||||
'status',
|
||||
'approved_by',
|
||||
'approved_at',
|
||||
'approval_id',
|
||||
'reject_reason',
|
||||
'created_by',
|
||||
'updated_by',
|
||||
@@ -33,6 +35,7 @@ class Leave extends Model
|
||||
protected $casts = [
|
||||
'tenant_id' => 'int',
|
||||
'user_id' => 'int',
|
||||
'approval_id' => 'int',
|
||||
'approved_by' => 'int',
|
||||
'created_by' => 'int',
|
||||
'updated_by' => 'int',
|
||||
@@ -92,6 +95,11 @@ public function creator(): BelongsTo
|
||||
return $this->belongsTo(User::class, 'created_by');
|
||||
}
|
||||
|
||||
public function approval(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Approval::class, 'approval_id');
|
||||
}
|
||||
|
||||
// =========================================================================
|
||||
// Accessor
|
||||
// =========================================================================
|
||||
|
||||
Reference in New Issue
Block a user