added member-state seeds without checking for birthdates

This commit is contained in:
vagrant
2018-09-11 22:23:46 +00:00
parent da2dfc1701
commit 4154c68111
5 changed files with 83 additions and 13 deletions
+4 -5
View File
@@ -22,7 +22,6 @@ class Person extends Model
public function isMember()
{
$latest = $this->memberStates->last();
if (is_null($latest)) {
return false;
} else {
@@ -56,7 +55,7 @@ class Person extends Model
/*
* Return the last date since when the person is an active member.
*
*
* @return Carbon\Carbon
*/
public function activeSince()
@@ -64,7 +63,7 @@ class Person extends Model
$latest = $this->memberStates
->orderBy('joining_date', 'desc')
->first();
return Carbon::parse($latest['joining_date']);
}
@@ -76,7 +75,7 @@ class Person extends Model
public function activeTime()
{
$activeTimes = $this->memberStates;
$diff = 0;
foreach ($activeTimes as $period) {
@@ -84,7 +83,7 @@ class Person extends Model
$end = is_null($period['leaving_date']) ?
Carbon::now() :
Carbon::parse($period['leaving_date']);
$diffYears = Carbon::parse($start)->diffInYears($end);
$diffDays = Carbon::parse($start)->diffInDays($end);