Made Person mass assignable.
Added an isEven() function to check, if the person has any open targets.
This commit is contained in:
@@ -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 = [];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user