diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 00000000..9b362dcf --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,12 @@ +# These are supported funding model platforms + +# github: stancl +patreon: samuelstancl +open_collective: # Replace with a single Open Collective username +ko_fi: samuelstancl +tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +custom: ['https://www.paypal.me/samuelstancl', 'https://gumroad.com/l/tenancy'] diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..7dcde1af --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,28 @@ +name: CI + +on: + push: + branches: [ 2.x ] + pull_request: + branches: [ 2.x ] + +jobs: + tests: + runs-on: ubuntu-latest + + strategy: + matrix: + laravel: ["^6.0", "^7.0"] + + steps: + - uses: actions/checkout@v2 + - name: Start docker containers + run: docker-compose up -d + - name: Install dependencies + run: docker-compose exec test composer require --no-interaction "laravel/framework:$LARAVEL_VERSION" + - name: Run tests + run: ./fulltest + - name: Send code coverage to codecov + env: + CODECOV_TOKEN: 24382d15-84e7-4a55-bea4-c4df96a24a9b + run: bash <(curl -s https://codecov.io/bash) diff --git a/DONATIONS.md b/DONATIONS.md index 0b0cb90f..e1e9efe9 100644 --- a/DONATIONS.md +++ b/DONATIONS.md @@ -4,9 +4,13 @@ Any donations will be greatly appreciated and help ensure that the package is de If you're a company and this package is helping you make money, please consider donating. +### Patreon + +If you would like to support me on a monthly basis, you can use Patreon: https://patreon.com/samuelstancl + ### PayPal -PayPal is the preferable donation method as it comes with the lowest fees. +PayPal is the preferable donation method for one-time donations as it comes with the lowest fees. You can donate here: [https://paypal.me/samuelstancl](https://paypal.me/samuelstancl) @@ -16,11 +20,17 @@ If you can't use PayPal, you may use my Gumroad link. This comes with higher fee You can donate here: [https://gumroad.com/l/tenancy](https://gumroad.com/l/tenancy) +### Bank transfer + +If you'd like to donate money from your bank account, you can can do that too. I use [TransferWise](https://transferwise.com/invite/u/samuels1719) (affiliate link 🙂), so I can accept bank transfers in virtually any currency. + +Contact me on [samuel.stancl@gmail.com](mailto:samuel.stancl@gmail.com?subject=Donation) and I'll give you bank details for your local currency. + ### Legal If you're a business making a donation, you may want an invoice. -Contact me on [samuel.stancl@gmail.com](mailto:samuel.stancl@gmail.com) and let me know what you need to have on the invoice and I will make it happen. +Contact me on [samuel.stancl@gmail.com](mailto:samuel.stancl@gmail.com?subject=Donation%20with%20invoice) and let me know what you need to have on the invoice and I will make it happen. ### Thank you! diff --git a/SUPPORT.md b/SUPPORT.md index 8f782e51..e35775e1 100644 --- a/SUPPORT.md +++ b/SUPPORT.md @@ -2,6 +2,8 @@ If you need help with implementing the package, you can: - Open an [issue here on GitHub](https://github.com/stancl/tenancy/issues/new?assignees=stancl&labels=support&template=support-question.md&title=) -- Message me (`@stancl`) on the [Unofficial Laravel Discord](https://discord.gg/zGVGFAd), in the `#stancl_tenancy` channel +- Join our new [Discord server](https://discord.gg/7cpgPxv) and ask in `#help` + +The methods above are preferred, but you may also - Contact me on Telegram: [@samuelstancl](https://t.me/samuelstancl) - Send me an email: [samuel.stancl@gmail.com](mailto:samuel.stancl@gmail.com) diff --git a/src/StorageDrivers/Database/CachedTenantResolver.php b/src/StorageDrivers/Database/CachedTenantResolver.php index 9a4a345c..db4d5a46 100644 --- a/src/StorageDrivers/Database/CachedTenantResolver.php +++ b/src/StorageDrivers/Database/CachedTenantResolver.php @@ -28,7 +28,7 @@ class CachedTenantResolver return $this->config->get('tenancy.storage_drivers.db.cache_ttl'); } - public function getTenantIdByDomain(string $domain, Closure $query): string + public function getTenantIdByDomain(string $domain, Closure $query): ?string { return $this->cache->remember('_tenancy_domain_to_id:' . $domain, $this->ttl(), $query); } diff --git a/src/Traits/TenantAwareCommand.php b/src/Traits/TenantAwareCommand.php index e86168df..fb11df9f 100644 --- a/src/Traits/TenantAwareCommand.php +++ b/src/Traits/TenantAwareCommand.php @@ -14,14 +14,8 @@ trait TenantAwareCommand protected function execute(InputInterface $input, OutputInterface $output) { $tenants = $this->getTenants(); - - if (count($tenants) === 1) { - return $tenants[0]->run(function () { - return $this->laravel->call([$this, 'handle']); - }); - } - $exitCode = 0; + foreach ($tenants as $tenant) { $result = (int) $tenant->run(function () { return $this->laravel->call([$this, 'handle']);