[WIP] Update
This commit is contained in:
@@ -151,13 +151,20 @@ class Member extends Model
|
||||
}
|
||||
|
||||
public function currentPolicy()
|
||||
{
|
||||
return $this->hasOneThrough(CorporatePolicy::class, MemberPolicy::class, 'member_id', 'code', 'member_id', 'policy_id')
|
||||
->where('status', 'active')
|
||||
->orderBy('end', 'DESC');
|
||||
// return $this->hasOne(MemberPolicy::class, 'member_id', 'member_id')->where('status', 'active')->latestOfMany();
|
||||
}
|
||||
|
||||
public function currentActivePolicy()
|
||||
{
|
||||
return $this->hasOneThrough(CorporatePolicy::class, MemberPolicy::class, 'member_id', 'code', 'member_id', 'policy_id')
|
||||
->where('corporate_policies.start', '<', now())
|
||||
->where('corporate_policies.end', '>', now())
|
||||
->where('member_policies.start', '<', now())
|
||||
->where('member_policies.end', '>', now());
|
||||
// return $this->hasOne(MemberPolicy::class, 'member_id', 'member_id')->where('status', 'active')->latestOfMany();
|
||||
}
|
||||
|
||||
public function getAgeAttribute()
|
||||
|
||||
Reference in New Issue
Block a user