1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2025-12-12 17:04:04 +00:00

Merge branch '2.x' of github.com:stancl/tenancy into 2.x

This commit is contained in:
Samuel Štancl 2020-04-23 13:05:18 +02:00
commit a688c27455
6 changed files with 57 additions and 11 deletions

12
.github/FUNDING.yml vendored Normal file
View file

@ -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']

28
.github/workflows/ci.yml vendored Normal file
View file

@ -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)

View file

@ -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. 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
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) 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) 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 ### Legal
If you're a business making a donation, you may want an invoice. 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! ### Thank you!

View file

@ -2,6 +2,8 @@
If you need help with implementing the package, you can: 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=) - 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) - Contact me on Telegram: [@samuelstancl](https://t.me/samuelstancl)
- Send me an email: [samuel.stancl@gmail.com](mailto:samuel.stancl@gmail.com) - Send me an email: [samuel.stancl@gmail.com](mailto:samuel.stancl@gmail.com)

View file

@ -28,7 +28,7 @@ class CachedTenantResolver
return $this->config->get('tenancy.storage_drivers.db.cache_ttl'); 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); return $this->cache->remember('_tenancy_domain_to_id:' . $domain, $this->ttl(), $query);
} }

View file

@ -14,14 +14,8 @@ trait TenantAwareCommand
protected function execute(InputInterface $input, OutputInterface $output) protected function execute(InputInterface $input, OutputInterface $output)
{ {
$tenants = $this->getTenants(); $tenants = $this->getTenants();
if (count($tenants) === 1) {
return $tenants[0]->run(function () {
return $this->laravel->call([$this, 'handle']);
});
}
$exitCode = 0; $exitCode = 0;
foreach ($tenants as $tenant) { foreach ($tenants as $tenant) {
$result = (int) $tenant->run(function () { $result = (int) $tenant->run(function () {
return $this->laravel->call([$this, 'handle']); return $this->laravel->call([$this, 'handle']);