Add data user to db old lms
This commit is contained in:
@@ -336,35 +336,37 @@ class MemberEnrollmentService
|
|||||||
$this->member = $member;
|
$this->member = $member;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function dateParser($date_from_row) {
|
public function dateParser($date_from_row)
|
||||||
|
{
|
||||||
|
|
||||||
if ($date_from_row instanceof DateTime) {
|
if ($date_from_row instanceof DateTime) {
|
||||||
return $date_from_row->format('Y-m-d');
|
return $date_from_row->format('Y-m-d');
|
||||||
} else if ($date_from_row != null) {
|
} else if ($date_from_row != null) {
|
||||||
if (strtotime($date_from_row)){
|
if (strtotime($date_from_row)) {
|
||||||
return date('Y-m-d', strtotime($date_from_row));
|
return date('Y-m-d', strtotime($date_from_row));
|
||||||
} else {
|
} else {
|
||||||
// throw new ImportRowException(__('Format Date Invalid'), 0, null, $date_from_row);
|
// throw new ImportRowException(__('Format Date Invalid'), 0, null, $date_from_row);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// throw new ImportRowException(__('Format Date Invalid'), 0, null, $date_from_row);
|
// throw new ImportRowException(__('Format Date Invalid'), 0, null, $date_from_row);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function validateDate($dateString, $dateFormat = 'Ymd'){
|
public function validateDate($dateString, $dateFormat = 'Ymd')
|
||||||
|
{
|
||||||
$date = DateTime::createFromFormat($dateFormat, $dateString);
|
$date = DateTime::createFromFormat($dateFormat, $dateString);
|
||||||
if ($date && ($date->format($dateFormat) == $dateString)) {
|
if ($date && ($date->format($dateFormat) == $dateString)) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function validateRow($row)
|
protected function validateRow($row)
|
||||||
{
|
{
|
||||||
$title =[
|
$title = [
|
||||||
'member_effective_date' => 'Member Effective Date',
|
'member_effective_date' => 'Member Effective Date',
|
||||||
'member_expiry_date' => 'Member Expired Date',
|
'member_expiry_date' => 'Member Expired Date',
|
||||||
'activation_date' => 'Activation Date',
|
'activation_date' => 'Activation Date',
|
||||||
@@ -401,13 +403,13 @@ class MemberEnrollmentService
|
|||||||
|
|
||||||
if ($row['record_type'] == 'D') {
|
if ($row['record_type'] == 'D') {
|
||||||
$member = Member::query()
|
$member = Member::query()
|
||||||
->where('member_id', $row['principal_id'])
|
->where('member_id', $row['principal_id'])
|
||||||
// ->whereHas('employeds', function ($query) use ($corporate) {
|
// ->whereHas('employeds', function ($query) use ($corporate) {
|
||||||
// $query->where('corporate_id', $corporate->id);
|
// $query->where('corporate_id', $corporate->id);
|
||||||
// })
|
// })
|
||||||
->first();
|
->first();
|
||||||
|
|
||||||
if(empty($member)){
|
if (empty($member)) {
|
||||||
// throw new ImportRowException(__('enrollment.PRINCIPAL_NOT_IN_MEMBER_ID'), 0, null, $row);
|
// throw new ImportRowException(__('enrollment.PRINCIPAL_NOT_IN_MEMBER_ID'), 0, null, $row);
|
||||||
} else {
|
} else {
|
||||||
// if ($member['record_type'] != 'P'){
|
// if ($member['record_type'] != 'P'){
|
||||||
@@ -551,11 +553,11 @@ class MemberEnrollmentService
|
|||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$activation_date = NULL;
|
$activation_date = NULL;
|
||||||
if (!empty($row['activation_date'])){
|
if (!empty($row['activation_date'])) {
|
||||||
$activation_date = $row['activation_date'];
|
$activation_date = $row['activation_date'];
|
||||||
}
|
}
|
||||||
$date_terminated = NULL;
|
$date_terminated = NULL;
|
||||||
if(!empty($row['date_terminated'])){
|
if (!empty($row['date_terminated'])) {
|
||||||
$date_terminated = $row['date_terminated'];
|
$date_terminated = $row['date_terminated'];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -627,7 +629,7 @@ class MemberEnrollmentService
|
|||||||
$date_terminated = $this->dateParser($row['date_terminated']);
|
$date_terminated = $this->dateParser($row['date_terminated']);
|
||||||
|
|
||||||
|
|
||||||
if(!empty($row['activation_date'])){
|
if (!empty($row['activation_date'])) {
|
||||||
// $activation_date = date("Y-m-d", strtotime($row['activation_date']));
|
// $activation_date = date("Y-m-d", strtotime($row['activation_date']));
|
||||||
// if (($activation_date == $date_terminated) && ($activation_date == $member_effective_date)) {
|
// if (($activation_date == $date_terminated) && ($activation_date == $member_effective_date)) {
|
||||||
// throw new ImportRowException(__('enrollment.MORE_THAN', [
|
// throw new ImportRowException(__('enrollment.MORE_THAN', [
|
||||||
@@ -638,7 +640,7 @@ class MemberEnrollmentService
|
|||||||
// ]), 0, null, $row);
|
// ]), 0, null, $row);
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
if (!empty($row['date_terminated'])){
|
if (!empty($row['date_terminated'])) {
|
||||||
// $date_terminated = date("Y-m-d", strtotime($row['date_terminated']));
|
// $date_terminated = date("Y-m-d", strtotime($row['date_terminated']));
|
||||||
// if($date_terminated){
|
// if($date_terminated){
|
||||||
// if ($date_terminated <= $member_effective_date && ($date_terminated != $member_effective_date)) {
|
// if ($date_terminated <= $member_effective_date && ($date_terminated != $member_effective_date)) {
|
||||||
@@ -712,7 +714,7 @@ class MemberEnrollmentService
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
||||||
if($corporate->code != $row['corporate_id']){
|
if ($corporate->code != $row['corporate_id']) {
|
||||||
throw new ImportRowException(__('enrollment.CORPORATE_CODE_NOT_MATCH', [
|
throw new ImportRowException(__('enrollment.CORPORATE_CODE_NOT_MATCH', [
|
||||||
'corporate_id' => $row['corporate_id']
|
'corporate_id' => $row['corporate_id']
|
||||||
]), 0, null, $row);
|
]), 0, null, $row);
|
||||||
@@ -744,6 +746,7 @@ class MemberEnrollmentService
|
|||||||
);
|
);
|
||||||
$member->person_id = $person->id;
|
$member->person_id = $person->id;
|
||||||
$member->save();
|
$member->save();
|
||||||
|
|
||||||
throw new ImportRowException(__('enrollment.MEMBER_UNIQUE', [
|
throw new ImportRowException(__('enrollment.MEMBER_UNIQUE', [
|
||||||
'member_id' => $row['member_id'],
|
'member_id' => $row['member_id'],
|
||||||
'policy_id' => $row['policy_number']
|
'policy_id' => $row['policy_number']
|
||||||
@@ -752,6 +755,75 @@ class MemberEnrollmentService
|
|||||||
$member = new Member();
|
$member = new Member();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($row['relationship_with_principal'] == 'H') {
|
||||||
|
$sMartialStatus = 6;
|
||||||
|
$nIDHubunganKeluarga = 3;
|
||||||
|
} else if ($row['relationship_with_principal'] == 'W') {
|
||||||
|
$sMartialStatus = 7;
|
||||||
|
$nIDHubunganKeluarga = 4;
|
||||||
|
} else if ($row['relationship_with_principal'] == 'S') {
|
||||||
|
$sMartialStatus = 4;
|
||||||
|
$nIDHubunganKeluarga = 5;
|
||||||
|
} else if ($row['relationship_with_principal'] == 'D') {
|
||||||
|
$sMartialStatus = 5;
|
||||||
|
$nIDHubunganKeluarga = 5;
|
||||||
|
} else {
|
||||||
|
$sMartialStatus = 0;
|
||||||
|
$nIDHubunganKeluarga = 0;
|
||||||
|
}
|
||||||
|
if ($row['sex'] == 'M') {
|
||||||
|
$nIDJenisKelamin = 1;
|
||||||
|
} else {
|
||||||
|
$nIDJenisKelamin = 2;
|
||||||
|
};
|
||||||
|
|
||||||
|
$name = explode(" ", $row['name']);
|
||||||
|
// First name
|
||||||
|
$first_name = isset($name[0]) ? $name[0] : '';
|
||||||
|
// Middle name
|
||||||
|
$middle_name = isset($name[1]) ? $name[1] : '';
|
||||||
|
// Last name
|
||||||
|
$last_name = '';
|
||||||
|
if (count($name) > 2) {
|
||||||
|
$last_name = implode(" ", array_slice($name, 2));
|
||||||
|
}
|
||||||
|
|
||||||
|
$userLms = User::create(
|
||||||
|
[
|
||||||
|
'sFirstName' => $first_name,
|
||||||
|
'sLastName' => $middle_name . ' ' . $last_name, // Ubah ini dengan variabel yang sesuai dengan nama belakang (last name)
|
||||||
|
'sPhone' => $row['telephone_mobile'],
|
||||||
|
'sEmail' => str_replace(' ', '', $row['email']),
|
||||||
|
'nIDHubunganKeluarga' => $nIDHubunganKeluarga !== 0 ? $nIDHubunganKeluarga : null,
|
||||||
|
'dUpdateOn' => date('Y-m-d H:i:s'),
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$nIDUser = $userLms->nID;
|
||||||
|
$userLmsDetail = UserDetail::create(
|
||||||
|
[
|
||||||
|
'nIDUser' => $nIDUser,
|
||||||
|
// 'dTanggalLahir' => $row['date_of_birth'],
|
||||||
|
'dTanggalLahir' => $this->dateParser($row['date_of_birth']),
|
||||||
|
'dCreateOn' => date('Y-m-d H:i:s'),
|
||||||
|
'sMartialStatus' => $sMartialStatus != 0 ? $sMartialStatus : null,
|
||||||
|
'nIDJenisKelamin' => $nIDJenisKelamin,
|
||||||
|
'sCreateBy' => $nIDUser,
|
||||||
|
'sKTP' => $row['nric'] ?? null,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
UserInsurance::updateOrCreate(
|
||||||
|
['nIDUser' => $nIDUser],
|
||||||
|
[
|
||||||
|
'sNamaPeserta' => $row['name'],
|
||||||
|
'dStartDate' => $row['member_effective_date'],
|
||||||
|
'dExpireDate' => $row['member_expiry_date'],
|
||||||
|
'dTanggalLahir' => $row['date_of_birth'] ? $this->dateParser($row['date_of_birth']) : null,
|
||||||
|
'sNoPolis' => $row['member_id']
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
$memberPolicy = $member->policies()
|
$memberPolicy = $member->policies()
|
||||||
->where('policy_id', $row['policy_number'])
|
->where('policy_id', $row['policy_number'])
|
||||||
->first();
|
->first();
|
||||||
@@ -765,13 +837,13 @@ class MemberEnrollmentService
|
|||||||
|
|
||||||
// Validate If Plan Exist
|
// Validate If Plan Exist
|
||||||
// TODO validate corporate plan
|
// TODO validate corporate plan
|
||||||
$plans = explode(",",$row['plan_id']);
|
$plans = explode(",", $row['plan_id']);
|
||||||
if (count($plans) > 0) {
|
if (count($plans) > 0) {
|
||||||
foreach($plans as $d){
|
foreach ($plans as $d) {
|
||||||
$plan = Plan::query()
|
$plan = Plan::query()
|
||||||
->where('code', $d)
|
->where('code', $d)
|
||||||
->where('corporate_id', $corporate->id)
|
->where('corporate_id', $corporate->id)
|
||||||
->first();
|
->first();
|
||||||
if (!$plan) {
|
if (!$plan) {
|
||||||
throw new ImportRowException(__('enrollment.PLAN_NOT_FOUND'), 0, null, $row);
|
throw new ImportRowException(__('enrollment.PLAN_NOT_FOUND'), 0, null, $row);
|
||||||
}
|
}
|
||||||
@@ -836,13 +908,13 @@ class MemberEnrollmentService
|
|||||||
]);
|
]);
|
||||||
// Bisa disini penyebab data dobel
|
// Bisa disini penyebab data dobel
|
||||||
|
|
||||||
$plans = explode(",",$row['plan_id']);
|
$plans = explode(",", $row['plan_id']);
|
||||||
if (count($plans) > 0) {
|
if (count($plans) > 0) {
|
||||||
foreach($plans as $d){
|
foreach ($plans as $d) {
|
||||||
$plan = Plan::query()
|
$plan = Plan::query()
|
||||||
->where('code', $d)
|
->where('code', $d)
|
||||||
->where('corporate_id', $corporate->id)
|
->where('corporate_id', $corporate->id)
|
||||||
->first();
|
->first();
|
||||||
if (!$plan) {
|
if (!$plan) {
|
||||||
throw new ImportRowException(__('enrollment.PLAN_NOT_FOUND'), 0, null, $row);
|
throw new ImportRowException(__('enrollment.PLAN_NOT_FOUND'), 0, null, $row);
|
||||||
}
|
}
|
||||||
@@ -868,7 +940,6 @@ class MemberEnrollmentService
|
|||||||
'end' => $this->dateParser($row['member_expiry_date']),
|
'end' => $this->dateParser($row['member_expiry_date']),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
DB::commit();
|
DB::commit();
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
@@ -877,7 +948,7 @@ class MemberEnrollmentService
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "2": // Member Information Update (Without Replacement Card)
|
case "2": // Member Information Update (Without Replacement Card)
|
||||||
|
|
||||||
$this->validateRow($row);
|
$this->validateRow($row);
|
||||||
$member = Member::query()
|
$member = Member::query()
|
||||||
->where('member_id', $row['member_id'])
|
->where('member_id', $row['member_id'])
|
||||||
@@ -964,11 +1035,11 @@ class MemberEnrollmentService
|
|||||||
|
|
||||||
$division_id = $division->id;
|
$division_id = $division->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Bisa disini penyebab data dobel
|
// Bisa disini penyebab data dobel
|
||||||
$member->employeds()->updateOrCreate([
|
$member->employeds()->updateOrCreate([
|
||||||
'division_id' => $division_id
|
'division_id' => $division_id
|
||||||
],[
|
], [
|
||||||
'corporate_id' => $corporate->id,
|
'corporate_id' => $corporate->id,
|
||||||
'branch_code' => $row['branch_code'],
|
'branch_code' => $row['branch_code'],
|
||||||
'division_id' => $division_id ?? null,
|
'division_id' => $division_id ?? null,
|
||||||
@@ -979,26 +1050,28 @@ class MemberEnrollmentService
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$plans = explode(",",$row['plan_id']);
|
$plans = explode(",", $row['plan_id']);
|
||||||
if (count($plans) > 0) {
|
if (count($plans) > 0) {
|
||||||
foreach($plans as $d){
|
foreach ($plans as $d) {
|
||||||
$plan = Plan::query()
|
$plan = Plan::query()
|
||||||
->where('code', $d)
|
->where('code', $d)
|
||||||
->where('corporate_id', $corporate->id)
|
->where('corporate_id', $corporate->id)
|
||||||
->first();
|
->first();
|
||||||
if (!$plan) {
|
if (!$plan) {
|
||||||
throw new ImportRowException(__('enrollment.PLAN_NOT_FOUND'), 0, null, $row);
|
throw new ImportRowException(__('enrollment.PLAN_NOT_FOUND'), 0, null, $row);
|
||||||
}
|
}
|
||||||
$member->memberPlans()->updateOrCreate([
|
$member->memberPlans()->updateOrCreate(
|
||||||
'member_id' => $member->id,
|
[
|
||||||
'plan_id' => $plan->id,
|
'member_id' => $member->id,
|
||||||
],
|
'plan_id' => $plan->id,
|
||||||
[
|
],
|
||||||
'plan_id' => $plan->id,
|
[
|
||||||
'status' => 'active',
|
'plan_id' => $plan->id,
|
||||||
'start' => $this->dateParser($row['member_effective_date']),
|
'status' => 'active',
|
||||||
'end' => $this->dateParser($row['member_expiry_date']),
|
'start' => $this->dateParser($row['member_effective_date']),
|
||||||
]);
|
'end' => $this->dateParser($row['member_expiry_date']),
|
||||||
|
]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$plan = Plan::query()
|
$plan = Plan::query()
|
||||||
@@ -1008,16 +1081,18 @@ class MemberEnrollmentService
|
|||||||
if (!$plan) {
|
if (!$plan) {
|
||||||
throw new ImportRowException(__('enrollment.PLAN_NOT_FOUND'), 0, null, $row);
|
throw new ImportRowException(__('enrollment.PLAN_NOT_FOUND'), 0, null, $row);
|
||||||
}
|
}
|
||||||
$member->memberPlans()->updateOrCreate([
|
$member->memberPlans()->updateOrCreate(
|
||||||
'member_id' => $member->id,
|
[
|
||||||
'plan_id' => $plan->id,
|
'member_id' => $member->id,
|
||||||
],
|
'plan_id' => $plan->id,
|
||||||
[
|
],
|
||||||
'plan_id' => $plan->id,
|
[
|
||||||
'status' => 'active',
|
'plan_id' => $plan->id,
|
||||||
'start' => $this->dateParser($row['member_effective_date']),
|
'status' => 'active',
|
||||||
'end' => $this->dateParser($row['member_expiry_date']),
|
'start' => $this->dateParser($row['member_effective_date']),
|
||||||
]);
|
'end' => $this->dateParser($row['member_expiry_date']),
|
||||||
|
]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
// end update plan
|
// end update plan
|
||||||
|
|
||||||
@@ -1025,7 +1100,7 @@ class MemberEnrollmentService
|
|||||||
$userInsuranceLms = UserInsurance::query()
|
$userInsuranceLms = UserInsurance::query()
|
||||||
->where('sNoPolis', $row['member_id'])
|
->where('sNoPolis', $row['member_id'])
|
||||||
->first();
|
->first();
|
||||||
if ($userInsuranceLms){
|
if ($userInsuranceLms) {
|
||||||
$userInsuranceLms->sNamaPeserta = $row['name'];
|
$userInsuranceLms->sNamaPeserta = $row['name'];
|
||||||
$userInsuranceLms->dStartDate = $row['member_effective_date'];
|
$userInsuranceLms->dStartDate = $row['member_effective_date'];
|
||||||
$userInsuranceLms->dExpireDate = $row['member_expiry_date'];
|
$userInsuranceLms->dExpireDate = $row['member_expiry_date'];
|
||||||
@@ -1038,20 +1113,20 @@ class MemberEnrollmentService
|
|||||||
'dStartDate' => $row['member_effective_date'],
|
'dStartDate' => $row['member_effective_date'],
|
||||||
'dExpireDate' => $row['member_expiry_date'],
|
'dExpireDate' => $row['member_expiry_date'],
|
||||||
'dTanggalLahir' => $row['date_of_birth'] ? $this->dateParser($row['date_of_birth']) : null,
|
'dTanggalLahir' => $row['date_of_birth'] ? $this->dateParser($row['date_of_birth']) : null,
|
||||||
// 'nNoKTP' => $row['nric'] ?? ,
|
'sNoPolis' => $row['member_id']
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
/* Lihat ID Marital status di table tm_status_pernikahan Linksehat */
|
/* Lihat ID Marital status di table tm_status_pernikahan Linksehat */
|
||||||
if ($row['relationship_with_principal'] == 'H'){
|
if ($row['relationship_with_principal'] == 'H') {
|
||||||
$sMartialStatus= 6;
|
$sMartialStatus = 6;
|
||||||
$nIDHubunganKeluarga = 3;
|
$nIDHubunganKeluarga = 3;
|
||||||
} else if ($row['relationship_with_principal'] == 'W'){
|
} else if ($row['relationship_with_principal'] == 'W') {
|
||||||
$sMartialStatus = 7;
|
$sMartialStatus = 7;
|
||||||
$nIDHubunganKeluarga = 4;
|
$nIDHubunganKeluarga = 4;
|
||||||
} else if ($row['relationship_with_principal'] == 'S'){
|
} else if ($row['relationship_with_principal'] == 'S') {
|
||||||
$sMartialStatus = 4;
|
$sMartialStatus = 4;
|
||||||
$nIDHubunganKeluarga = 5;
|
$nIDHubunganKeluarga = 5;
|
||||||
} else if ($row['relationship_with_principal'] == 'D'){
|
} else if ($row['relationship_with_principal'] == 'D') {
|
||||||
$sMartialStatus = 5;
|
$sMartialStatus = 5;
|
||||||
$nIDHubunganKeluarga = 5;
|
$nIDHubunganKeluarga = 5;
|
||||||
} else {
|
} else {
|
||||||
@@ -1060,7 +1135,7 @@ class MemberEnrollmentService
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if($row['sex'] == 'M'){
|
if ($row['sex'] == 'M') {
|
||||||
$nIDJenisKelamin = 1;
|
$nIDJenisKelamin = 1;
|
||||||
} else {
|
} else {
|
||||||
$nIDJenisKelamin = 2;
|
$nIDJenisKelamin = 2;
|
||||||
@@ -1082,7 +1157,7 @@ class MemberEnrollmentService
|
|||||||
],
|
],
|
||||||
[
|
[
|
||||||
'sFirstName' => $first_name,
|
'sFirstName' => $first_name,
|
||||||
'sLastName' => $middle_name . ' ' .$last_name, // Ubah ini dengan variabel yang sesuai dengan nama belakang (last name)
|
'sLastName' => $middle_name . ' ' . $last_name, // Ubah ini dengan variabel yang sesuai dengan nama belakang (last name)
|
||||||
'sPhone' => $row['telephone_mobile'],
|
'sPhone' => $row['telephone_mobile'],
|
||||||
'sEmail' => str_replace(' ', '', $row['email']),
|
'sEmail' => str_replace(' ', '', $row['email']),
|
||||||
'nIDHubunganKeluarga' => $nIDHubunganKeluarga !== 0 ? $nIDHubunganKeluarga : null,
|
'nIDHubunganKeluarga' => $nIDHubunganKeluarga !== 0 ? $nIDHubunganKeluarga : null,
|
||||||
@@ -1105,9 +1180,8 @@ class MemberEnrollmentService
|
|||||||
'sKTP' => $row['nric'] ?? null,
|
'sKTP' => $row['nric'] ?? null,
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$memberPolicy) {
|
if (!$memberPolicy) {
|
||||||
throw new ImportRowException(__('enrollment.MEMBER_NOT_EXISTS', [
|
throw new ImportRowException(__('enrollment.MEMBER_NOT_EXISTS', [
|
||||||
'member_id' => $row['member_id'],
|
'member_id' => $row['member_id'],
|
||||||
@@ -1600,11 +1674,9 @@ class MemberEnrollmentService
|
|||||||
$value = $row_data[$this->doc_headers_to_field_map[$header]] ?? null;
|
$value = $row_data[$this->doc_headers_to_field_map[$header]] ?? null;
|
||||||
if (is_string($value)) {
|
if (is_string($value)) {
|
||||||
$cells[] = WriterEntityFactory::createCell($value);
|
$cells[] = WriterEntityFactory::createCell($value);
|
||||||
}
|
} else if ($value instanceof DateTime) {
|
||||||
else if ($value instanceof DateTime) {
|
|
||||||
$cells[] = WriterEntityFactory::createCell(Carbon::parse($value)->format('Ymd'));
|
$cells[] = WriterEntityFactory::createCell(Carbon::parse($value)->format('Ymd'));
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$cells[] = WriterEntityFactory::createCell($value);
|
$cells[] = WriterEntityFactory::createCell($value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1613,13 +1685,13 @@ class MemberEnrollmentService
|
|||||||
}
|
}
|
||||||
|
|
||||||
// This validation for range date in period corporate // validasi untuk range tanggal dalam period corporate yang ditentukan
|
// This validation for range date in period corporate // validasi untuk range tanggal dalam period corporate yang ditentukan
|
||||||
public function validateRangePeriode($dates){
|
public function validateRangePeriode($dates)
|
||||||
|
{
|
||||||
$date = date("Y-m-d", strtotime($dates));
|
$date = date("Y-m-d", strtotime($dates));
|
||||||
if (!isset($corporate->currentPolicy) || $corporate->currentPolicy->start <= $date) {
|
if (!isset($corporate->currentPolicy) || $corporate->currentPolicy->start <= $date) {
|
||||||
|
|
||||||
}
|
}
|
||||||
if (!isset($corporate->currentPolicy) || $corporate->currentPolicy->end >= $date) {
|
if (!isset($corporate->currentPolicy) || $corporate->currentPolicy->end >= $date) {
|
||||||
dd($corporate->currentPolicy->end, $dates);
|
dd($corporate->currentPolicy->end, $dates);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace App\Models\OLDLMS;
|
namespace App\Models\OLDLMS;
|
||||||
|
|
||||||
use Illuminate\Contracts\Auth\MustVerifyEmail;
|
use Illuminate\Contracts\Auth\MustVerifyEmail;
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||||
@@ -77,4 +78,17 @@ class User extends Authenticatable
|
|||||||
{
|
{
|
||||||
return $this->notificationTokens()->pluck('token')->toArray();
|
return $this->notificationTokens()->pluck('token')->toArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected static function boot()
|
||||||
|
{
|
||||||
|
parent::boot();
|
||||||
|
|
||||||
|
static::creating(function ($user) {
|
||||||
|
$user->sIPAddress = request()->ip();
|
||||||
|
});
|
||||||
|
|
||||||
|
static::updating(function ($user) {
|
||||||
|
$user->sIPAddress = request()->ip();
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user