diff --git a/assets/TenancyServiceProvider.stub.php b/assets/TenancyServiceProvider.stub.php index 5b4afbf6..10f069be 100644 --- a/assets/TenancyServiceProvider.stub.php +++ b/assets/TenancyServiceProvider.stub.php @@ -11,7 +11,7 @@ use Stancl\Tenancy\Middleware; use Stancl\JobPipeline\JobPipeline; use Illuminate\Support\Facades\Event; use Illuminate\Support\ServiceProvider; -use Stancl\Tenancy\TenancyUrlGenerator; +use Stancl\Tenancy\Overrides\TenancyUrlGenerator; use Illuminate\Support\Facades\Route as RouteFacade; use Stancl\Tenancy\Actions\CloneRoutesAsTenant; use Stancl\Tenancy\Middleware\InitializeTenancyByPath; diff --git a/assets/config.php b/assets/config.php index 05220836..35fee7f0 100644 --- a/assets/config.php +++ b/assets/config.php @@ -4,7 +4,7 @@ declare(strict_types=1); use Stancl\Tenancy\Middleware; use Stancl\Tenancy\Resolvers; -use Stancl\Tenancy\RouteMode; +use Stancl\Tenancy\Enums\RouteMode; return [ /** diff --git a/src/Actions/CloneRoutesAsTenant.php b/src/Actions/CloneRoutesAsTenant.php index f296e8ee..a391d199 100644 --- a/src/Actions/CloneRoutesAsTenant.php +++ b/src/Actions/CloneRoutesAsTenant.php @@ -9,8 +9,8 @@ use Illuminate\Config\Repository; use Illuminate\Routing\Route; use Illuminate\Routing\Router; use Illuminate\Support\Collection; +use Stancl\Tenancy\Enums\RouteMode; use Stancl\Tenancy\PathIdentificationManager; -use Stancl\Tenancy\RouteMode; /** * The CloneRoutesAsTenant action clones diff --git a/src/Bootstrappers/BroadcastTenancyBootstrapper.php b/src/Bootstrappers/BroadcastTenancyBootstrapper.php index 2f625437..6bfc5c67 100644 --- a/src/Bootstrappers/BroadcastTenancyBootstrapper.php +++ b/src/Bootstrappers/BroadcastTenancyBootstrapper.php @@ -10,7 +10,7 @@ use Illuminate\Contracts\Broadcasting\Broadcaster; use Illuminate\Foundation\Application; use Stancl\Tenancy\Contracts\TenancyBootstrapper; use Stancl\Tenancy\Contracts\Tenant; -use Stancl\Tenancy\TenancyBroadcastManager; +use Stancl\Tenancy\Overrides\TenancyBroadcastManager; class BroadcastTenancyBootstrapper implements TenancyBootstrapper { diff --git a/src/Bootstrappers/CacheTagsBootstrapper.php b/src/Bootstrappers/CacheTagsBootstrapper.php index 7ab28c96..eeca1a79 100644 --- a/src/Bootstrappers/CacheTagsBootstrapper.php +++ b/src/Bootstrappers/CacheTagsBootstrapper.php @@ -20,7 +20,7 @@ use Stancl\Tenancy\Contracts\Tenant; class CacheTagsBootstrapper implements TenancyBootstrapper { protected ?CacheManager $originalCache = null; - public static string $cacheManagerWithTags = \Stancl\Tenancy\CacheManager::class; + public static string $cacheManagerWithTags = \Stancl\Tenancy\Overrides\CacheManager::class; public function __construct( protected Application $app diff --git a/src/Bootstrappers/UrlBindingBootstrapper.php b/src/Bootstrappers/UrlBindingBootstrapper.php index a795ed4f..db29a925 100644 --- a/src/Bootstrappers/UrlBindingBootstrapper.php +++ b/src/Bootstrappers/UrlBindingBootstrapper.php @@ -9,7 +9,7 @@ use Illuminate\Routing\UrlGenerator; use Illuminate\Support\Facades\URL; use Stancl\Tenancy\Contracts\TenancyBootstrapper; use Stancl\Tenancy\Contracts\Tenant; -use Stancl\Tenancy\TenancyUrlGenerator; +use Stancl\Tenancy\Overrides\TenancyUrlGenerator; /** * Makes the app use TenancyUrlGenerator (instead of Illuminate\Routing\UrlGenerator) which: diff --git a/src/Concerns/DealsWithEarlyIdentification.php b/src/Concerns/DealsWithEarlyIdentification.php index fc6973c8..99993112 100644 --- a/src/Concerns/DealsWithEarlyIdentification.php +++ b/src/Concerns/DealsWithEarlyIdentification.php @@ -10,8 +10,8 @@ use Illuminate\Routing\Route; use Illuminate\Routing\Router; use Illuminate\Support\Arr; use Illuminate\Support\Facades\Route as RouteFacade; -use Stancl\Tenancy\Context; -use Stancl\Tenancy\RouteMode; +use Stancl\Tenancy\Enums\Context; +use Stancl\Tenancy\Enums\RouteMode; // todo1 Name – maybe DealsWithMiddlewareContexts? trait DealsWithEarlyIdentification diff --git a/src/Concerns/UsableWithEarlyIdentification.php b/src/Concerns/UsableWithEarlyIdentification.php index f018b794..beb405d5 100644 --- a/src/Concerns/UsableWithEarlyIdentification.php +++ b/src/Concerns/UsableWithEarlyIdentification.php @@ -7,11 +7,11 @@ namespace Stancl\Tenancy\Concerns; use Illuminate\Contracts\Http\Kernel; use Illuminate\Http\Request; use Illuminate\Routing\Route; -use Stancl\Tenancy\Context; +use Stancl\Tenancy\Enums\Context; +use Stancl\Tenancy\Enums\RouteMode; use Stancl\Tenancy\Exceptions\MiddlewareNotUsableWithUniversalRoutesException; use Stancl\Tenancy\Middleware\IdentificationMiddleware; use Stancl\Tenancy\Middleware\PreventAccessFromUnwantedDomains; -use Stancl\Tenancy\RouteMode; /** * This trait provides methods that check if a middleware's execution should be skipped. diff --git a/src/Context.php b/src/Enums/Context.php similarity index 72% rename from src/Context.php rename to src/Enums/Context.php index 649ffdbc..d72ece32 100644 --- a/src/Context.php +++ b/src/Enums/Context.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Stancl\Tenancy; +namespace Stancl\Tenancy\Enums; enum Context { diff --git a/src/RouteMode.php b/src/Enums/RouteMode.php similarity index 77% rename from src/RouteMode.php rename to src/Enums/RouteMode.php index 51210fe4..b64e550c 100644 --- a/src/RouteMode.php +++ b/src/Enums/RouteMode.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Stancl\Tenancy; +namespace Stancl\Tenancy\Enums; enum RouteMode { diff --git a/src/Features/ViteBundler.php b/src/Features/ViteBundler.php index e3fee2fa..96f379b7 100644 --- a/src/Features/ViteBundler.php +++ b/src/Features/ViteBundler.php @@ -6,8 +6,8 @@ namespace Stancl\Tenancy\Features; use Illuminate\Foundation\Application; use Stancl\Tenancy\Contracts\Feature; +use Stancl\Tenancy\Overrides\Vite; use Stancl\Tenancy\Tenancy; -use Stancl\Tenancy\Vite; class ViteBundler implements Feature { diff --git a/src/Listeners/ForgetTenantParameter.php b/src/Listeners/ForgetTenantParameter.php index ce5d324e..a4eb32cd 100644 --- a/src/Listeners/ForgetTenantParameter.php +++ b/src/Listeners/ForgetTenantParameter.php @@ -5,8 +5,8 @@ declare(strict_types=1); namespace Stancl\Tenancy\Listeners; use Illuminate\Routing\Events\RouteMatched; +use Stancl\Tenancy\Enums\RouteMode; use Stancl\Tenancy\PathIdentificationManager; -use Stancl\Tenancy\RouteMode; /** * Remove the tenant parameter from the matched route when path identification is used globally. diff --git a/src/Middleware/InitializeTenancyByPath.php b/src/Middleware/InitializeTenancyByPath.php index 3de3e25a..2d6ffe57 100644 --- a/src/Middleware/InitializeTenancyByPath.php +++ b/src/Middleware/InitializeTenancyByPath.php @@ -11,12 +11,12 @@ use Illuminate\Support\Facades\URL; use Stancl\Tenancy\Concerns\UsableWithEarlyIdentification; use Stancl\Tenancy\Concerns\UsableWithUniversalRoutes; use Stancl\Tenancy\Contracts\Tenant; +use Stancl\Tenancy\Enums\RouteMode; use Stancl\Tenancy\Events\InitializingTenancy; use Stancl\Tenancy\Exceptions\RouteIsMissingTenantParameterException; +use Stancl\Tenancy\Overrides\TenancyUrlGenerator; use Stancl\Tenancy\Resolvers\PathTenantResolver; -use Stancl\Tenancy\RouteMode; use Stancl\Tenancy\Tenancy; -use Stancl\Tenancy\TenancyUrlGenerator; /** * @see Stancl\Tenancy\Listeners\ForgetTenantParameter diff --git a/src/Middleware/InitializeTenancyByRequestData.php b/src/Middleware/InitializeTenancyByRequestData.php index 4645e426..b3de6115 100644 --- a/src/Middleware/InitializeTenancyByRequestData.php +++ b/src/Middleware/InitializeTenancyByRequestData.php @@ -9,9 +9,9 @@ use Illuminate\Http\Request; use Stancl\Tenancy\Concerns\UsableWithEarlyIdentification; use Stancl\Tenancy\Concerns\UsableWithUniversalRoutes; use Stancl\Tenancy\Exceptions\TenantCouldNotBeIdentifiedByRequestDataException; +use Stancl\Tenancy\Overrides\TenancyUrlGenerator; use Stancl\Tenancy\Resolvers\RequestDataTenantResolver; use Stancl\Tenancy\Tenancy; -use Stancl\Tenancy\TenancyUrlGenerator; class InitializeTenancyByRequestData extends IdentificationMiddleware implements UsableWithUniversalRoutes { diff --git a/src/Middleware/PreventAccessFromUnwantedDomains.php b/src/Middleware/PreventAccessFromUnwantedDomains.php index 1c609cfb..5e28b1c2 100644 --- a/src/Middleware/PreventAccessFromUnwantedDomains.php +++ b/src/Middleware/PreventAccessFromUnwantedDomains.php @@ -8,8 +8,8 @@ use Closure; use Illuminate\Http\Request; use Illuminate\Routing\Route; use Stancl\Tenancy\Concerns\UsableWithEarlyIdentification; -use Stancl\Tenancy\Context; -use Stancl\Tenancy\RouteMode; +use Stancl\Tenancy\Enums\Context; +use Stancl\Tenancy\Enums\RouteMode; /** * todo come up with a better name. diff --git a/src/CacheManager.php b/src/Overrides/CacheManager.php similarity index 96% rename from src/CacheManager.php rename to src/Overrides/CacheManager.php index f28134b8..0495c951 100644 --- a/src/CacheManager.php +++ b/src/Overrides/CacheManager.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Stancl\Tenancy; +namespace Stancl\Tenancy\Overrides; use Illuminate\Cache\CacheManager as BaseCacheManager; diff --git a/src/TenancyBroadcastManager.php b/src/Overrides/TenancyBroadcastManager.php similarity index 98% rename from src/TenancyBroadcastManager.php rename to src/Overrides/TenancyBroadcastManager.php index 59e30b57..16e44a40 100644 --- a/src/TenancyBroadcastManager.php +++ b/src/Overrides/TenancyBroadcastManager.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Stancl\Tenancy; // todo new Overrides namespace? +namespace Stancl\Tenancy\Overrides; use Illuminate\Broadcasting\Broadcasters\Broadcaster; use Illuminate\Broadcasting\BroadcastManager; diff --git a/src/TenancyUrlGenerator.php b/src/Overrides/TenancyUrlGenerator.php similarity index 98% rename from src/TenancyUrlGenerator.php rename to src/Overrides/TenancyUrlGenerator.php index 3c0da89c..5566d74e 100644 --- a/src/TenancyUrlGenerator.php +++ b/src/Overrides/TenancyUrlGenerator.php @@ -2,10 +2,11 @@ declare(strict_types=1); -namespace Stancl\Tenancy; // todo new Overrides namespace? +namespace Stancl\Tenancy\Overrides; use Illuminate\Routing\UrlGenerator; use Illuminate\Support\Arr; +use Stancl\Tenancy\PathIdentificationManager; /** * This class is used in place of the default UrlGenerator when UrlBindingBootstrapper is enabled. diff --git a/src/Vite.php b/src/Overrides/Vite.php similarity index 77% rename from src/Vite.php rename to src/Overrides/Vite.php index ca47fcc3..66bc9268 100644 --- a/src/Vite.php +++ b/src/Overrides/Vite.php @@ -2,11 +2,11 @@ declare(strict_types=1); -namespace Stancl\Tenancy; +namespace Stancl\Tenancy\Overrides; use Illuminate\Foundation\Vite as BaseVite; -class Vite extends BaseVite // todo move to a different directory in v4 +class Vite extends BaseVite { /** * Generate an asset path for the application. diff --git a/tests/BootstrapperTest.php b/tests/BootstrapperTest.php index fc09d3f8..96ae90a5 100644 --- a/tests/BootstrapperTest.php +++ b/tests/BootstrapperTest.php @@ -15,11 +15,11 @@ use Illuminate\Support\Facades\Route; use Illuminate\Support\Facades\Storage; use Stancl\Tenancy\Events\TenancyEnded; use Stancl\Tenancy\Jobs\CreateDatabase; -use Stancl\Tenancy\TenancyUrlGenerator; +use Stancl\Tenancy\Overrides\TenancyUrlGenerator; use Stancl\Tenancy\Events\TenantCreated; use Stancl\Tenancy\Events\TenantDeleted; use Stancl\Tenancy\Events\DeletingTenant; -use Stancl\Tenancy\TenancyBroadcastManager; +use Stancl\Tenancy\Overrides\TenancyBroadcastManager; use Illuminate\Filesystem\FilesystemAdapter; use Illuminate\Broadcasting\BroadcastManager; use Stancl\Tenancy\Events\TenancyInitialized; diff --git a/tests/BroadcastingTest.php b/tests/BroadcastingTest.php index 808bfe53..78f7f677 100644 --- a/tests/BroadcastingTest.php +++ b/tests/BroadcastingTest.php @@ -5,7 +5,7 @@ declare(strict_types=1); use Illuminate\Support\Facades\Event; use Stancl\Tenancy\Events\TenancyEnded; use Illuminate\Support\Facades\Broadcast; -use Stancl\Tenancy\TenancyBroadcastManager; +use Stancl\Tenancy\Overrides\TenancyBroadcastManager; use Illuminate\Broadcasting\BroadcastManager; use Stancl\Tenancy\Events\TenancyInitialized; use Stancl\Tenancy\Listeners\BootstrapTenancy; diff --git a/tests/EarlyIdentificationTest.php b/tests/EarlyIdentificationTest.php index d78a62c8..39f31bba 100644 --- a/tests/EarlyIdentificationTest.php +++ b/tests/EarlyIdentificationTest.php @@ -4,7 +4,7 @@ declare(strict_types=1); use Illuminate\Support\Arr; use Illuminate\Routing\Route; -use Stancl\Tenancy\RouteMode; +use Stancl\Tenancy\Enums\RouteMode; use Stancl\Tenancy\Tests\Etc\Tenant; use Illuminate\Contracts\Http\Kernel; use Illuminate\Support\Facades\Event; diff --git a/tests/Features/ViteBundlerTest.php b/tests/Features/ViteBundlerTest.php index 0d4c9069..8254e8cc 100644 --- a/tests/Features/ViteBundlerTest.php +++ b/tests/Features/ViteBundlerTest.php @@ -4,7 +4,7 @@ declare(strict_types=1); use Illuminate\Foundation\Vite; use Stancl\Tenancy\Tests\Etc\Tenant; -use Stancl\Tenancy\Vite as StanclVite; +use Stancl\Tenancy\Overrides\Vite as StanclVite; use Stancl\Tenancy\Features\ViteBundler; test('vite helper uses our custom class', function() { diff --git a/tests/GlobalCacheTest.php b/tests/GlobalCacheTest.php index 22fc2641..204ae12a 100644 --- a/tests/GlobalCacheTest.php +++ b/tests/GlobalCacheTest.php @@ -2,7 +2,7 @@ declare(strict_types=1); -use Stancl\Tenancy\CacheManager; +use Stancl\Tenancy\Overrides\CacheManager; use Stancl\Tenancy\Tests\Etc\Tenant; use Illuminate\Support\Facades\Event; use Stancl\Tenancy\Events\TenancyEnded; diff --git a/tests/PreventAccessFromUnwantedDomainsTest.php b/tests/PreventAccessFromUnwantedDomainsTest.php index 7143ce97..1f34bf7f 100644 --- a/tests/PreventAccessFromUnwantedDomainsTest.php +++ b/tests/PreventAccessFromUnwantedDomainsTest.php @@ -2,7 +2,7 @@ declare(strict_types=1); -use Stancl\Tenancy\RouteMode; +use Stancl\Tenancy\Enums\RouteMode; use Illuminate\Contracts\Http\Kernel; use Illuminate\Support\Facades\Route; use Stancl\Tenancy\Middleware\InitializeTenancyByDomain; diff --git a/tests/UniversalRouteTest.php b/tests/UniversalRouteTest.php index 94db6db8..892247f0 100644 --- a/tests/UniversalRouteTest.php +++ b/tests/UniversalRouteTest.php @@ -24,7 +24,7 @@ use Stancl\Tenancy\Exceptions\TenantCouldNotBeIdentifiedByPathException; use Stancl\Tenancy\Exceptions\TenantCouldNotBeIdentifiedOnDomainException; use Stancl\Tenancy\Exceptions\MiddlewareNotUsableWithUniversalRoutesException; use Stancl\Tenancy\Exceptions\TenantCouldNotBeIdentifiedByRequestDataException; -use Stancl\Tenancy\RouteMode; +use Stancl\Tenancy\Enums\RouteMode; test('a route can be universal using domain identification', function (array $routeMiddleware, array $globalMiddleware) { foreach ($globalMiddleware as $middleware) {