'datetime', ]; } public function invitedBy(): BelongsTo { return $this->belongsTo(User::class, 'invited_by_user_id'); } public function organisation(): BelongsTo { return $this->belongsTo(Organisation::class); } public function event(): BelongsTo { return $this->belongsTo(Event::class); } public function scopePending(Builder $query): Builder { return $query->where('status', 'pending'); } public function scopeExpired(Builder $query): Builder { return $query->where('status', 'expired') ->orWhere(fn (Builder $q) => $q->where('status', 'pending')->where('expires_at', '<', now())); } }