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

803 commits

Author SHA1 Message Date
beezerk23
233a1222bf
feat(UniversalRoutes): Stop overwriting the (maybe) customized onFail… (#679)
* feat(UniversalRoutes): Stop overwriting the (maybe) customized onFail method and just call it in case of an exception

* throw correct exception when `$originalOnFail()` is null

* Update DomainTest.php

* convert test to pest and renamed

* Update tests/DomainTest.php

Co-authored-by: Samuel Štancl <samuel@archte.ch>

Co-authored-by: Abrar Ahmad <abrar.dev99@gmail.com>
Co-authored-by: Samuel Štancl <samuel@archte.ch>
2022-07-25 18:37:52 +02:00
Bram Wubs
747c192979
Fix ArgumentCountError on the TenantAssetsController (#894)
* Fix ArgumentCount exception on the TenantAssetsController when no `$path` is provided

* CS

* CS

* Handle null case explicitly

* code style

Co-authored-by: Bram Wubs <bram@sibi.nl>
Co-authored-by: Samuel Štancl <samuel@archte.ch>
2022-07-20 21:35:33 +02:00
PHP CS Fixer
c0f97fa04e Fix code style (php-cs-fixer) 2022-07-20 13:29:11 +00:00
Abrar Ahmad
97ab483173
Completing PR #881 (#902)
* install PHP CS Fixer

* Fix styling

* remove StyleCI config

* use config from archtechx/template

* Fix styling

* added `php-cs-fixer`

* Update .php-cs-fixer.php

* added GitHub token

* Update ci.yml

* Update ci.yml

* Update ci.yml

* php-cs-fixer workflow same as template

Co-authored-by: Erik Gaal <me@erikgaal.nl>
Co-authored-by: erikgaal <erikgaal@users.noreply.github.com>
2022-07-20 15:28:45 +02:00
Abrar Ahmad
627233d07a
[4.x] Don't use onDeleteCascade in the migrations (#883)
* removed `cascade` on delete for domains

* removed only `onDelete` cascade

* keep impersonation migrations unchanged

* domains set null on delete

* Update 2019_09_15_000020_create_domains_table.php

* Added DeleteDomain Job while deleting tenant.

* Update assets/TenancyServiceProvider.stub.php

Co-authored-by: Samuel Štancl <samuel@archte.ch>

* renamed class

* Update DeleteDomains.php

* onDelete restrict

* revert nullable

* removed `shouldQueue` interface

* Update TenancyServiceProvider.stub.php

* fetch and delete domains individually

* Update DeleteDomains.php

* tests for `DeleteDomains` job

Co-authored-by: Samuel Štancl <samuel@archte.ch>
2022-07-20 13:02:33 +02:00
Nick Kitchen
cc6d4fe0dd
[4.x] Added support for Microsoft Sql Server (#715)
* added support for microsoft sql server database

* added support for microsoft sql server database

* trigger ci

* revert change

* trigger ci

* Try installing pdo_sqlsrv

* different approach for installing sqlsrv via pecl

* add dependencies

* add gnupg2

* Update Dockerfile

* try skipping msodbcsql17

* Update Dockerfile

* add dependency back

* update before installing

* try to add mssql

* mssql host

* TENANCY_TEST_MSSQL_HOST env var

* add env vars for mssql

* add sqlsrv vars to TestCase

* rename vars to SQLSRV [skip ci]

* MSSQL -> SQLSRV

Co-authored-by: Samuel Štancl <samuel@archte.ch>
Co-authored-by: Samuel Štancl <samuel.stancl@gmail.com>
2022-06-23 13:04:53 +02:00
Victor R
7d98ebb5d1
[4.x] Add tenant schema dump command (#807)
* Add tenant dump command

* Register tenant schema dump command

* Added tests for tenant schema dump command

* remove docblocks, fix tenant() logic

* trigger ci

* Install mysql-client

* mysql-client -> mariadb-client

* add tenant-schema-test.dump to .gitignore

Co-authored-by: Samuel Štancl <samuel@archte.ch>
Co-authored-by: Samuel Štancl <samuel.stancl@gmail.com>
2022-06-01 16:12:59 +02:00
Samuel Štancl
eca7b336bc merge 3.x 2022-06-01 14:58:44 +02:00
Vincent GS
51228defc6
[3.x][Filesystem] Provide an additional argument for tenant name path (#817)
* Let the user pass the tenant suffix by %tenant%

In this PR we let the user pass an additional parameter using `%tenant%` so the user can additionally pass the folder corresponding to each tenant.
This is my proposal, because if I try to use %storage_path% within Linux, I get the full path to the project when I use Google Cloud Storage

* Missing missing updates

Moving from $subject to $root when %storage_path% has been replaced
2022-05-26 11:51:27 +02:00
Samuel Štancl
4d95e88e27 Revert "Resolve #854"
This reverts commit a1c3442148.
2022-05-15 13:45:54 +02:00
Samuel Štancl
a1c3442148
Resolve #854 2022-05-15 13:32:09 +02:00
Nathan Dunn
40bf576e00
[3.x] Update PostgreSQLSchemaManager to set correct config key value (#840)
* Update PostgreSQLSchemaManager to set correct config key value

* Update to use version_compare

* Update TenantDatabaseManagerTest

* Improve TenantDatabaseManagerTest

* Update TenantDatabaseManager
2022-04-08 03:13:29 +02:00
Roy de Vos Burchart
f065ea60b0
Update QueueTenancyBootstrapper.php (#836) 2022-04-01 22:53:09 +02:00
Samuel Štancl
349125c02e
Merge hotfix branch (#834)
* try specifying the signature in __construct

* constructor doesn't work since Reflection is used, try specifying getDefaultName() instead

* Fixed: make migration commands compatible

* Fix failing tests

* Fix username generation

* Re-create tmp dir as well if needed

* wip
2022-03-30 18:00:55 +02:00
Samuel Štancl
600bb823de avoid double // in prefix 2022-03-23 20:49:25 +01:00
Samuel Štancl
5026f54a6d fix path prefixing 2022-03-23 20:48:55 +01:00
Samuel Štancl
49ebb75f00
Fixes #827 2022-03-17 12:46:49 +01:00
Erik Gaal
79e3d53b06
[3.x] Compatibility with Laravel 9 (#802)
* Test on Laravel 9

* Don't extend final Kernel class

* Make FilesystemTenancyBootstrapper compatible with Flysystem v3

Co-authored-by: George <jiri.zizka@funfirst.cz>

* Update tenant maintenance mode te be in line with Laravel

* Exclude PHP 7.4 <> L9 combination from testing

* add root_override-related assertions

* getPrefix -> getPathPrefix

* handle / inconsistency in s3 prefix

* Refactor Storage facade changes

Co-authored-by: George <jiri.zizka@funfirst.cz>
Co-authored-by: Samuel Štancl <samuel.stancl@gmail.com>
2022-03-08 01:50:25 +01:00
masiorama
b4a4eab949
Add drop of db views on migrate fresh command (#812)
* Optionally handle drop of table views on MigrateFresh

@stancl I managed to make the modification discussed here #811 
Afaik (and I can understand) this is the easiest way to handle it, but I'm open to discuss.

* Remove redundant store variable

* code style

Co-authored-by: Samuel Štancl <samuel@archte.ch>
2022-02-22 16:26:07 +01:00
Samuel Štancl
368d3cc99f add forceRefresh option to QueueTenancyBootstrapper 2022-02-19 16:21:27 +01:00
Samuel Štancl
27f916c323 end tenancy in queue if the next job is not tenant aware 2022-02-19 16:12:38 +01:00
Jori Stein
f08e33afd8
Remove redondant initialization (#775) 2022-01-06 21:35:56 +01:00
Samuel Štancl
e442bdb644 Only use JobRetryRequested in Laravel 8 2021-12-31 18:29:05 +01:00
Samuel Štancl
a83568ded2 Only use JobRetryRequested in Laravel 8 2021-12-31 18:28:37 +01:00
Samuel Štancl
73a4a3018c Improve queue tenancy 2021-12-31 18:10:03 +01:00
Samuel Štancl
5980c46449 wip 2021-12-30 19:46:48 +01:00
Stefan Ninic
435d8528a7
Fixed array to string conversion (#718)
* Fixed array to string conversion

Previous code would give this warning before actually showing exception message
`<warning>PHP Warning:  Array to string conversion in .../vendor/stancl/tenancy/src/CacheManager.php on line 24</warning>`

* Update variable & syntax

Co-authored-by: Samuel Štancl <samuel.stancl@gmail.com>
2021-12-25 22:10:34 +01:00
Samuel Štancl
3ab09ec83d Merge branch '3.x' into v9-test 2021-12-25 16:54:03 +01:00
sort72
08bfd6f9bb
Use tenant key on console commands instead of id (#768) 2021-12-25 15:24:34 +01:00
Frederic Habich
2726f07bca
fixed typo (#766)
fixed typo within description 'searhced' => 'searched'
2021-12-22 13:24:07 +01:00
Samuel Štancl
9883219544 wip 2021-12-13 13:09:16 +01:00
Jasper Zonneveld
b58b068434
Add missing import for Domain model (#745) 2021-11-03 10:21:51 +01:00
Ralfs Garkaklis
20e1fa1959
Fixed typo (#684) 2021-07-08 13:32:17 +02:00
hackerESQ
740d670665
Adds ability to disable tenant asset routes (#636)
* Add option to enable/disable tenant asset route

* Only registers tenant route if enabled in config

* Uses proper config key

* Move routes config option

* Move config to service provider

* Moves config to service provider
2021-04-22 11:09:16 +02:00
stancl
6bcd327b75 Apply fixes from StyleCI 2021-04-22 09:04:14 +00:00
Samuel Štancl
3ee1e36653
Set key type to string when uuids are used 2021-04-22 11:04:06 +02:00
Ralfs
c21beabd3e
Fix issue 632: cached lookup (#633)
* Instead of querying Domain model, find Tenant and eager load it's domain via Tenant model. Fixed cached lookup issue - when caching Tenant, also include the current Domain, so it can be later accessed via $tenant->domains->first() (even, when using multiple domains per tenant). Added tenantIdentifiedFromCache method in CachedTenantResolver.php, which can be used to set custom properties in resolvers after Tenant is loaded from cache.

* StlyeCi Fix - removed PHP 8 nullsafe operator for compatibility with older PHP versions, replaced with inline if

* Redundant variable '$domain', because $tenant is not null, only, when current domain is found and relationship is loaded (with only one domain).

* Fixed tenant()->domains showing incorrect data. Renamed tenantIdentifiedFromCache() method and removed duplicate code, when setting current domain.

* Removed select() for better flexibility, added new method setCurrentDomain(), refactored the usage of tenantIdentified().

* rename method to resolved()

* clean up code

* StyleCi Fix

Co-authored-by: Samuel Štancl <samuel.stancl@gmail.com>
2021-04-16 19:57:41 +02:00
Michael Lundbøl
27e9fb4a69
Fix arguments being initialized twice for tenants:seed command (#611) 2021-03-10 12:08:51 +01:00
mlajx
1a48725aef
Add static variable for MiddlewareUniversalName. (#581)
* Added middlewareUniversalName static variable to extends and customize the UniversalRoutes class

* change the variable name and undo the code style
2021-01-15 23:31:31 +01:00
Aleksandr Medvedev
04193cc2fd
Add phpdoc parameter to Tenant magic method for better IDE support (#565) 2020-12-19 13:39:16 +01:00
Samuel Štancl
30a1f9102d
PHP 8 support (#542)
* PHP 8 support, test workflow syntax

* Try using a custom data structure in the workflow

* Try using matrix include

* Default PHP target

* single include

* fix composer package name

* [WIP] Try using dev-master for valuestore

* Update spatie/valuestore constraint to be stable
2020-11-30 17:30:42 +01:00
Samuel Štancl
126afcd0dd
Terminating pipelines (#527)
* Return false from CreateDatabase job

* Terminating pipeline tests
2020-11-15 16:26:26 +01:00
Samuel Štancl
8f12dd8829
Update TenantCouldNotBeIdentifiedById.php 2020-11-14 16:45:52 +01:00
stancl
19c5820efd Apply fixes from StyleCI 2020-11-13 21:00:16 +00:00
Samuel Štancl
dc60276e6d Inject the Application contract instead of the concrete class 2020-11-13 22:00:02 +01:00
Samuel Štancl
8f34a733d8
Add tenancy()->central() helper (#526)
* Add tenancy()->central() helper

* Apply fixes from StyleCI

* Add docblock

* Fix return typehint

Co-authored-by: stancl <stancl@users.noreply.github.com>
2020-11-13 08:15:24 +01:00
Pete Cooper
dd1b7fc86d
Fix tenants:list when not using multi-domain tenancy (#504)
* Fix tenants:list when not using multi-domain tenancy

* formatting

* update to an if/else
2020-11-12 17:23:58 +01:00
Cristian Tudorache
1c93360077
Fix Typo in TenantCouldNotBeIdentifiedById (#525)
* Fix Typo in TenantCouldNotBeIdentifiedById

* Fix Typo in TenantCouldNotBeIdentifiedById
2020-11-12 15:14:20 +01:00
Dylan Harbour
e0af2e9945
Fix issue 521: Array input for --tenants (#522)
* Fix issue 521: Array input for `--tenants`

Tenancy for Laravel docs refer to using multiple `--tenants=<...> ` options when running a command for multiple tenants explicitly: https://tenancyforlaravel.com/docs/v3/console-commands

However, the command input is not defined correctly to receive arrays.
https://laravel.com/docs/7.x/artisan#input-arrays

This PR adds a failing test, fixes the issue and corrects a typo in the contributing readme.

* Styleci

Co-authored-by: Dylan Harbour <dylanh@ringier.co.za>
2020-11-12 14:08:37 +01:00
GENL
411d486282
Fix: The database name is displayed when the TenantDatabaseAlreadyExistsException exception is thrown. (#499)
* Fix: The database name is displayed when the TenantDatabaseAlreadyExistsException exception is thrown.

* Fix the code style

Co-authored-by: Henrich <Ekoumelong>
2020-09-23 19:47:35 +02:00