Add an expired function to the model
Closed this issue · 4 comments
m1guelpf commented
It would be cool (and very useful to #10) to have an setExpiredAttribute()
function on the Invite model, so you can do $invite->expired and get a boolean
m1guelpf commented
@clarkeash Commented #10 code, now you can see it.
m1guelpf commented
@clarkeash Would this work?
use Carbon\Carbon;
public function setExpiredAttribute()
{
return $this->getAttribute('valid_until') > Carbon::now() && $this->getAttribute('max') => $this->getAttribute('uses');
}
clarkeash commented
I have added a few helper methods to the model:
hasExpired()
isFull()
isRestricted()
isRestrictedFor($email)
isUseless()
- is full or expired.