where('account_id', $account->id) ->sum('filesize'); $photosSize = DB::table('photos') ->where('account_id', $account->id) ->sum('filesize'); return $documentsSize + $photosSize; } /** * Indicates whether the account has the reached the maximum storage size. * * @param Account $account * @return bool */ public static function hasReachedAccountStorageLimit(Account $account): bool { if (! config('monica.requires_subscription')) { return false; } $currentAccountSize = self::getAccountStorageSize($account); return $currentAccountSize > (config('monica.max_storage_size') * 1000000); } }