From 51e7567b91b04995f4b378ad987091b8db61a079 Mon Sep 17 00:00:00 2001 From: Dell Date: Wed, 27 Jul 2022 14:20:18 +0700 Subject: [PATCH] Fix Empty String to Null --- app/Models/Benefit.php | 2 +- app/Models/Plan.php | 21 +++++++++++++-------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/app/Models/Benefit.php b/app/Models/Benefit.php index 5919975e..d18ecf30 100644 --- a/app/Models/Benefit.php +++ b/app/Models/Benefit.php @@ -134,7 +134,7 @@ class Benefit extends Model public function setPrePostTreatmentAttribute($value) { - return empty($value) ? null : ($value == 'Y'); + $this->attributes['pre_post_treatment'] = empty($value) ? null : ($value == 'Y'); } public function getPrePostTreatmentAttribute($value) diff --git a/app/Models/Plan.php b/app/Models/Plan.php index d3238483..28943183 100644 --- a/app/Models/Plan.php +++ b/app/Models/Plan.php @@ -114,29 +114,34 @@ class Plan extends Model "Max Periode of Surgery Non Surgery" => "max_surgery_periode_days", ]; + public function setAreaLimitAttribute($value) + { + $this->attributes['area_limit'] = empty($value) ? null : $value; + } + public function setStartAttribute($value) { - return empty($valu) ? null : $value; + $this->attributes['start'] = empty($value) ? null : $value; } public function setEndAttribute($value) { - return empty($valu) ? null : $value; + $this->attributes['end'] = empty($value) ? null : $value; } - public function setMaxClaimCount($value) + public function setMaxClaimCountAttribute($value) { - return empty($value) ? null : $value; + $this->attributes['max_claim_count'] = empty($value) ? null : $value; } - public function setMaxSurgeryReinstatementDays($value) + public function setMaxSurgeryReinstatementDaysAttribute($value) { - return empty($value) ? null : $value; + $this->attributes['max_surgery_reinstatement_days'] = empty($value) ? null : $value; } - public function setMaxSurgeryPeriodeDays($value) + public function setMaxSurgeryPeriodeDaysAttribute($value) { - return empty($value) ? null : $value; + $this->attributes['max_surgery_periode_days'] = empty($value) ? null : $value; } public function scopeFilter($query, array $filters)