fix dashboard table

This commit is contained in:
Muhammad Fajar
2022-12-07 11:15:33 +07:00
parent f20cb5b44c
commit 5840a311e0
11 changed files with 236 additions and 41 deletions

View File

@@ -44,10 +44,10 @@ class Corporate extends Model
public function currentPolicy()
{
return $this->hasOne(CorporatePolicy::class)
// ->where('start', '<=', now())
// ->where('end', '>=', now())
->where('active', true)
->latestOfMany();
// ->where('start', '<=', now())
// ->where('end', '>=', now())
->where('active', true)
->latestOfMany();
}
public function corporatePlans()

View File

@@ -19,4 +19,9 @@ class CorporateEmployee extends Model
'nik',
'status'
];
public function division()
{
return $this->belongsTo(CorporateDivision::class, 'division_id');
}
}

View File

@@ -182,4 +182,14 @@ class Member extends Model
// });
});
}
// public function corporateEmployee()
// {
// return $this->hasOne(CorporateEmployee::class, 'member_id');
// }
public function division()
{
return $this->hasOneThrough(CorporateDivision::class, CorporateEmployee::class, 'member_id', 'id', 'id', 'division_id');
}
}