fix: remove remaining references to AttendancePolicy

This commit is contained in:
2026-07-16 10:31:07 +08:00
parent 4d1879d8ce
commit cf48496148
9 changed files with 153 additions and 160 deletions

View File

@@ -2,7 +2,6 @@
namespace App\Http\Controllers;
use App\Models\AttendancePolicy;
use App\Models\Branch;
use App\Models\Candidate;
use App\Models\Department;
@@ -205,9 +204,6 @@ class EmployeeController extends Controller
})
->get(['id', 'name', 'start_time', 'end_time']);
$attendancePolicies = \App\Models\AttendancePolicy::whereIn('created_by', getCompanyAndUsersId())
->where('status', 'active')
->get(['id', 'name']);
$roles = Role::whereIn('created_by', getCompanyAndUsersId())->get(['id', 'name']);
@@ -217,7 +213,7 @@ class EmployeeController extends Controller
'designations' => $designations,
'documentTypes' => $documentTypes,
'shifts' => $shifts,
'attendancePolicies' => $attendancePolicies,
'generatedEmployeeId'=> Employee::generateEmployeeId(),
'roles' => $roles,
'defaultRole' => $roles->firstWhere('name', 'employee')?->id,
@@ -539,9 +535,6 @@ class EmployeeController extends Controller
})
->get(['id', 'name', 'start_time', 'end_time']);
$attendancePolicies = \App\Models\AttendancePolicy::whereIn('created_by', getCompanyAndUsersId())
->where('status', 'active')
->get(['id', 'name']);
$roles = Role::whereIn('created_by', getCompanyAndUsersId())->get(['id', 'name']);
$currentRole = $user->roles->first();
@@ -553,7 +546,7 @@ class EmployeeController extends Controller
'designations' => $designations,
'documentTypes' => $documentTypes,
'shifts' => $shifts,
'attendancePolicies' => $attendancePolicies,
'roles' => $roles,
'currentRoleId' => $currentRole?->id,
]);
@@ -1392,16 +1385,6 @@ class EmployeeController extends Controller
}
}
$attendancePolicyId = null;
if (!empty($row['attendance_policy'])) {
$attendancePolicy = AttendancePolicy::whereIn('created_by', getCompanyAndUsersId())->where('name', $row['attendance_policy'])->first();
if (is_null($attendancePolicy)) {
$attendancePolicy = AttendancePolicy::whereIn('created_by', getCompanyAndUsersId())->first();
$attendancePolicyId = $attendancePolicy ? $attendancePolicy->id : null;
} else {
$attendancePolicyId = $attendancePolicy ? $attendancePolicy->id : null;
}
}
$user = User::create([
'name' => $row['name'],