[WIP] Claim
This commit is contained in:
@@ -132,6 +132,21 @@ class Benefit extends Model
|
||||
"Show Benefit Value" => 'show_benefit_value',
|
||||
];
|
||||
|
||||
public static $max_frequency_periods = [
|
||||
0 => 'Policy Period',
|
||||
1 => 'Daily Visit',
|
||||
2 => 'Weekly',
|
||||
3 => 'Monthly',
|
||||
4 => 'Yearly',
|
||||
5 => 'Disability',
|
||||
6 => 'Visit',
|
||||
];
|
||||
|
||||
protected $appends = [
|
||||
'max_frequency_period_name',
|
||||
'max_frequency'
|
||||
];
|
||||
|
||||
public function setAreaLimitAttribute($value)
|
||||
{
|
||||
$this->attributes['area_limit'] = empty($value) ? null : $value;
|
||||
@@ -168,4 +183,42 @@ class Benefit extends Model
|
||||
{
|
||||
return $this->belongsTo(Plan::class, 'plan_code', 'code');
|
||||
}
|
||||
|
||||
public function getMaxFrequencyPeriodNameAttribute()
|
||||
{
|
||||
return self::$max_frequency_periods[$this->max_frequency_period] ?? null;
|
||||
}
|
||||
|
||||
public function getMaxFrequencyAttribute()
|
||||
{
|
||||
switch ($this->max_frequency_period) {
|
||||
// case(0) :
|
||||
// // TODO Fix This
|
||||
// return null;
|
||||
// break;
|
||||
case(1) :
|
||||
return empty($this->daily_frequency) ? 1 : $this->daily_frequency;
|
||||
break;
|
||||
case(2) :
|
||||
return empty($this->weekly_frequency) ? 1 : $this->weekly_frequency;
|
||||
break;
|
||||
case(3) :
|
||||
return empty($this->monthly_frequency) ? 1 : $this->monthly_frequency;
|
||||
break;
|
||||
case(4) :
|
||||
return empty($this->yearly_frequency) ? 1 : $this->yearly_frequency;
|
||||
break;
|
||||
case(5) :
|
||||
// TODO Fix This
|
||||
return empty($this->max_period_for_disability) ? 1 : $this->max_period_for_disability;
|
||||
break;
|
||||
case(6) :
|
||||
// TODO Fix This
|
||||
return 1;
|
||||
break;
|
||||
default :
|
||||
return null;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,17 +99,24 @@ class Member extends Model
|
||||
|
||||
public function currentCorporate()
|
||||
{
|
||||
return $this->belongsToMany(Corporate::class, 'corporate_employees', 'corporate_id', 'member_id')
|
||||
// ->withPivot([
|
||||
// 'branch_code',
|
||||
// 'divison_id',
|
||||
// 'nik',
|
||||
// 'status',
|
||||
// 'start',
|
||||
// 'end'
|
||||
// ])
|
||||
->where('start', '<', now())
|
||||
->where('end', '>', now());
|
||||
// return $this->belongsToMany(Corporate::class, 'corporate_employees', 'corporate_id', 'member_id')
|
||||
// // ->withPivot([
|
||||
// // 'branch_code',
|
||||
// // 'divison_id',
|
||||
// // 'nik',
|
||||
// // 'status',
|
||||
// // 'start',
|
||||
// // 'end'
|
||||
// // ])
|
||||
// ->where('start', '<', now())
|
||||
// ->where('end', '>', now());
|
||||
|
||||
|
||||
return $this->hasOneThrough(Corporate::class, CorporateEmployee::class, 'member_id', 'id', 'id', 'corporate_id');
|
||||
// ->where('corporate_policies.start', '<', now())
|
||||
// ->where('corporate_policies.end', '>', now())
|
||||
// ->where('member_policies.start', '<', now())
|
||||
// ->where('member_policies.end', '>', now());
|
||||
}
|
||||
|
||||
public function memberPlans()
|
||||
|
||||
Reference in New Issue
Block a user