1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2025-12-15 23:24:03 +00:00
Commit graph

98 commits

Author SHA1 Message Date
lukinovec
740d4e78d8 Update prefix generator logic + tests 2023-04-13 12:46:33 +02:00
lukinovec
8ac4d87e94 Use a single original prefix 2023-04-13 07:47:18 +02:00
PHP CS Fixer
c9ba00c1fc Fix code style (php-cs-fixer) 2023-04-13 05:07:38 +00:00
lukinovec
4ab692bb05 Rename bootstrapper 2023-04-13 07:07:11 +02:00
lukinovec
9d9e2b32ce Add defaultPrefix property 2023-04-12 09:10:23 +02:00
lukinovec
e894c782ab Add info in comment 2023-04-12 08:33:45 +02:00
lukinovec
39e62c7dcf Make original prefixes customizable 2023-04-12 08:23:31 +02:00
lukinovec
70051e70b3 Rename bootstrapper 2023-04-11 15:01:08 +02:00
PHP CS Fixer
52dabed878 Fix code style (php-cs-fixer) 2023-04-11 12:29:44 +00:00
lukinovec
7ebfc375d6 Disable cache tagging by default, add CacheTagBootstrapper 2023-04-11 14:28:28 +02:00
lukinovec
5849afa4c8 Use $this->config instead of config() 2023-04-07 12:03:55 +02:00
lukinovec
840cd831d6 Delete CacheTenancyBootstrapper 2023-03-31 14:10:56 +02:00
lukinovec
1f1c7cc2bc Fix original prefix logic 2023-03-31 09:19:46 +02:00
lukinovec
8ea3cc9739 Use default prefix generator inline, delete the 'default' key logic 2023-03-31 07:51:20 +02:00
PHP CS Fixer
9388459d7d Fix code style (php-cs-fixer) 2023-03-14 16:30:41 +00:00
lukinovec
8348389fb3 Add customizing cache store prefixes 2023-03-14 17:22:56 +01:00
lukinovec
b715571927 Prefix all cache stores specified in $tenantCacheStores 2023-02-24 09:17:24 +01:00
lukinovec
249fc545d2
Merge branch 'master' into cache-prefix 2023-02-21 10:22:17 +01:00
lukinovec
d7a4982cd3
[4.x] Make broadcasting work with Tenancy (#1027)
* Add BroadcastTenancyBootstrapper and TenancyBroadcastManager

* Fix code style (php-cs-fixer)

* Bind original BroadcastManager again on `revert()`

* Fix code style (php-cs-fixer)

* Move manager to correct directory

* Fix property type

* Make BroadcastTenancyBootstrapper a singleton in tests

* Fix code style (php-cs-fixer)

* Bind the original broadcaster instance on `revert()`

* Instead of just forgetting the old broadcaster instance, bind the new one

* Add BroadcastTenancyBootstrapper tests

* Separate the test

* Fix code style (php-cs-fixer)

* Add bootstrapper test

* Add broadcaster channels test

* Clean up BootstrapperTest

* Fix BroadcastingTest

* Add comments to TenancyBroadcastManager

* Add BroadcastTenancyBootstrapper comments

* Simplify BroadcastManager extension, remove setDriver method

* Add comment

* Fix PHPStan errors

* Fix PHPStan errors

* Remove duplicate import

* Fix test

* Delete `::class` from test name

Co-authored-by: Samuel Štancl <samuel.stancl@gmail.com>

* Create databases for newly created tenants in BroadcastingTest

* move spatie/invade to require

---------

Co-authored-by: PHP CS Fixer <phpcsfixer@example.com>
Co-authored-by: Samuel Štancl <samuel.stancl@gmail.com>
2023-02-18 15:52:55 +01:00
lukinovec
fbdb13f392
[4.x] Set app.url config in UrlTenancyBootstrapper (#1068)
* Set `app.url` config in UrlTenancyBootstrapper

* Add assertions

* Set base app URL in config

* Make UrlTenancyBootstrapper a singleton
2023-02-18 13:01:17 +01:00
lukinovec
617e9a7a73
[4.x] Allow user to customize tenant's URL root in CLI (#1044)
* Add UrlTenancyBootstrapper

* Fix code style (php-cs-fixer)

* Move URL overriding to a separate method, call it in `boot()`

* Test URL root overriding

* Change parameter formatting

Co-authored-by: Samuel Štancl <samuel.stancl@gmail.com>

* Fix code style (php-cs-fixer)

* Improve URL bootstrapper test

* Move `$scheme` and `$hostname` to the closure

* Update code example comment

* Hardcode values instead of referencing variables

* Delete extra line

---------

Co-authored-by: PHP CS Fixer <phpcsfixer@example.com>
Co-authored-by: Samuel Štancl <samuel.stancl@gmail.com>
2023-02-17 10:56:43 +01:00
lukinovec
93aaba3e11 Merge branch 'master' of github.com:archtechx/tenancy into cache-prefix 2023-02-02 10:51:09 +01:00
PHP CS Fixer
9ed7308754 Fix code style (php-cs-fixer) 2023-02-01 10:33:33 +00:00
lukinovec
95170312ea Fix types 2023-02-01 11:33:09 +01:00
lukinovec
cc9928bc34 Hint Repository implementation instead of contract 2023-02-01 07:01:52 +01:00
lukinovec
342c67fe02
Add skip-failing option to the Migrate command (#945)
* Add and test Migrate command's skip-failing option

* Improve naming

* Move migration event dispatching inside try block

* Change test name

* Fix skip-failing test

* Use QueryException instead of Exception

* Correct TenantDatabaseDoesNotExistException import

* Correct test

* Check for the the testing env in DB bootstrapper

* Correct the Migrate command

* Fix code style (php-cs-fixer)

* add docs todo

* Add QueryException to the Migrat command try/catch

* Return status codes in Migrate

* Fix code style (php-cs-fixer)

* Add test for not stopping tenants:migrate after the first failure

* Update Migrate command

* Fix code style (php-cs-fixer)

* Fix code style (php-cs-fixer)

* Use `getTenants()`

* Use withtenantDatabases where needed

* Add withTenantDatabases to test

---------

Co-authored-by: PHP CS Fixer <phpcsfixer@example.com>
Co-authored-by: Samuel Štancl <samuel.stancl@gmail.com>
2023-02-01 06:55:26 +01:00
lukinovec
ba8cfdda85
Merge branch 'master' into cache-prefix 2023-01-31 08:17:22 +01:00
lukinovec
62a2ed163c Use my Laravel fork 2023-01-31 08:13:06 +01:00
lukinovec
30d73d2694 Change nonTenantCacheDrivers to tenantCacheStores 2023-01-05 16:13:00 +01:00
lukinovec
f8f0e1e5da
Merge branch 'master' into cache-prefix 2023-01-05 15:07:59 +01:00
lukinovec
86c388a2b6 Add nonTenantCacheDrivers check 2023-01-05 13:05:24 +01:00
lukinovec
4b0df42f8a Add and test nonTenantCacheDrivers 2023-01-05 12:47:03 +01:00
Samuel Štancl
a0256fd5f3 Merge branch 'master' of github.com:archtechx/tenancy 2023-01-04 03:27:04 +01:00
lukinovec
0f892f1585
Make tenants able to have custom mail credentials (#989)
* Replace MailManager singleton with an instance of a custom mail manager which always resolves the mailers instead of getting the cached ones

* Fix code style (php-cs-fixer)

* Add MailTenancyBootstrapper

* Add MailTenancyBootstrapper to tenancy.bootstrappers config (commented out)

* Fix code style (php-cs-fixer)

* Make credentials map a public static property

* Always resolve only the mailers specified in the mailersToNotCache public static property

* Fix typo in comment

* Update TenancyServiceProvider comment

* add todo

* Add comments to TenancyMailManager, rename property

* Remove the configKey array check

* Simplify bootstrap method

* Change $credentialsMap so that config keys are the keys, and the tenant property names are the values

* Rename $mailersToAlwaysResolve to $tenantMailers

* Update comment

* Update comment

* Rename variable in TenancyServiceProvider comment

* Scaffold tests

* Update comments after review

* Uncomment MailTenancyBootstrapper in config

* Use array_key_exists instead of null check

* Split config logic into methods

* Update mapping credentials

* Add tests for the added logic

* Fix code style (php-cs-fixer)

* Delete default 'smtp' mailer in $tenantMailers

* Add separate method to pick the appropriate mail credentials map preset

* Specify test name

* Move mail bootstrapper tests to BootstrapperTest

* Depend less on the default mailer by adding a static `$mailer` property

* Use static property for map presets

* Comment out MailTenancyBootstrapper from config

* Add return types to MailTenancyBootstrapper methods

* Update test name

* Move MailManager extension to MailTenancyBootstrapper

* Fix code style (php-cs-fixer)

* Update config reverting test

* Use `invade()` instead of ReflectionClass

* Fix constructor parameter formatting

* Delete TenancyMailManager, update tests

* Add return type

* Update comment

* Update MailTest

* Delete `group('mailer')`

* Delete bindNewMailManagerInstance()

* Delete remaining `group('mailer')`

* Fix comment

* Fix comment

Co-authored-by: PHP CS Fixer <phpcsfixer@example.com>
Co-authored-by: Samuel Štancl <samuel.stancl@gmail.com>
2023-01-04 02:12:25 +01:00
lukinovec
35a3412011 Move Cache::macro() to a slightly more appropriate place 2022-12-12 17:25:29 +01:00
lukinovec
9ec0b6dae3 Make Tenancy override CacheManager 2022-12-12 17:05:53 +01:00
lukinovec
dc9c8fcf68 Simplify cache store refreshing 2022-12-12 16:58:40 +01:00
PHP CS Fixer
012a39f79d Fix code style (php-cs-fixer) 2022-12-09 11:22:03 +00:00
lukinovec
50d46139f6 Add macro 2022-12-09 12:21:37 +01:00
lukinovec
825a565fa2 Update prefix bootstrapper and test (setStore() in CacheManager and Repository needed) 2022-12-08 16:24:54 +01:00
Abrar Ahmad
6c955acd13 CacheService class as singleton 2022-12-01 14:58:13 +05:00
Abrar Ahmad
222686ec1d CacheManager dependency injection test 2022-12-01 13:53:45 +05:00
Abrar Ahmad
169a7f7cc9 build prefix using original prefix 2022-11-30 13:25:07 +05:00
Abrar Ahmad
387a10b918 use proper DI 2022-11-30 10:22:01 +05:00
Samuel Štancl
ad29909a16 Make $tenantId nullable in initializeTenancyForQueue (revert phpstan change) 2022-11-29 10:25:22 +01:00
Abrar Ahmad
d6b4d9b7a7 user getTenantKey method 2022-11-28 15:09:39 +05:00
Abrar Ahmad
e550c7dcdd Update PrefixCacheTenancyBootstrapper.php 2022-11-24 11:57:14 +05:00
Abrar Ahmad
1e44ef214d add comments 2022-11-24 11:51:43 +05:00
Abrar Ahmad
2302571f6a Update PrefixCacheTenancyBootstrapper.php 2022-11-22 14:13:10 +05:00
Abrar Ahmad
c5f7de4b0e fix phpstan error 2022-11-22 14:09:59 +05:00