Made Person mass assignable.

Added an isEven() function to check, if the person has any open targets.
This commit is contained in:
Lukas Halbritter
2018-09-25 15:07:33 +02:00
parent 110c82c376
commit 89a86771b4
+19
View File
@@ -127,6 +127,22 @@ class Person extends Model
return $this->hasManyThrough('\App\SubBooking', '\App\PersonTarget');
}
/*
* Return, if the person is even.
*
* @return boolean
*/
public function isEven()
{
foreach ($this->targets as $target) {
if (!$target->isPaid()) {
return false;
}
}
return true;
}
/*
* Get the full name of the person.
*
@@ -140,4 +156,7 @@ class Person extends Model
return $this->surname . ' ' . $this->name_or_company;
}
}
// Make all attributes mass assignable.
protected $guarded = [];
}