'datetime']; public function account(): BelongsTo { return $this->belongsTo(User::class, 'account_id'); } public function member(): BelongsTo { return $this->belongsTo(User::class, 'user_id'); } public static function linkPendingInvitesFor(User $user): void { static::query() ->whereNull('user_id') ->where('status', self::STATUS_INVITED) ->whereRaw('LOWER(email) = ?', [strtolower($user->email)]) ->update([ 'user_id' => $user->id, 'status' => self::STATUS_ACTIVE, 'accepted_at' => now(), 'token' => null, ]); } }