mirror of
https://github.com/HolgerHatGarKeineNode/einundzwanzig-nostr.git
synced 2026-05-20 10:04:53 +00:00
🚀 Refactor: Centralize isBoardMember logic in EinundzwanzigPleb model and replace redundant checks
This commit is contained in:
@@ -50,4 +50,18 @@ class EinundzwanzigPleb extends Authenticatable implements CipherSweetEncrypted
|
||||
{
|
||||
return $this->hasMany(PaymentEvent::class);
|
||||
}
|
||||
|
||||
public function isBoardMember(): bool
|
||||
{
|
||||
return in_array($this->npub, config('einundzwanzig.config.current_board', []), true);
|
||||
}
|
||||
|
||||
public function hasPaidMembership(?int $year = null): bool
|
||||
{
|
||||
return $this->association_status->value > 1
|
||||
&& $this->paymentEvents()
|
||||
->where('year', $year ?? (int) date('Y'))
|
||||
->where('paid', true)
|
||||
->exists();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user