diff --git a/src/Bootstrappers/Integrations/PostgresTenancyBootstrapper.php b/src/Bootstrappers/Integrations/PostgresTenancyBootstrapper.php index 0a795ada..f18e3bcd 100644 --- a/src/Bootstrappers/Integrations/PostgresTenancyBootstrapper.php +++ b/src/Bootstrappers/Integrations/PostgresTenancyBootstrapper.php @@ -4,10 +4,10 @@ declare(strict_types=1); namespace Stancl\Tenancy\Bootstrappers\Integrations; -use Stancl\Tenancy\Contracts\Tenant; -use Illuminate\Database\DatabaseManager; use Illuminate\Contracts\Config\Repository; +use Illuminate\Database\DatabaseManager; use Stancl\Tenancy\Contracts\TenancyBootstrapper; +use Stancl\Tenancy\Contracts\Tenant; class PostgresTenancyBootstrapper implements TenancyBootstrapper { diff --git a/src/Database/Concerns/BelongsToTenant.php b/src/Database/Concerns/BelongsToTenant.php index 6c0def7e..b93eabbd 100644 --- a/src/Database/Concerns/BelongsToTenant.php +++ b/src/Database/Concerns/BelongsToTenant.php @@ -23,10 +23,9 @@ trait BelongsToTenant { // The queries performed for models present in the tenancy.models.rls are scoped using Postgres RLS instead of the global scope if (! in_array(static::class, config('tenancy.models.rls'))) { - static::addGlobalScope(new TenantScope); + static::addGlobalScope(new TenantScope); } - static::creating(function ($model) { if (! $model->getAttribute(Tenancy::tenantKeyColumn()) && ! $model->relationLoaded('tenant')) { if (tenancy()->initialized) { diff --git a/src/TenancyServiceProvider.php b/src/TenancyServiceProvider.php index bc11a474..24f8fa1b 100644 --- a/src/TenancyServiceProvider.php +++ b/src/TenancyServiceProvider.php @@ -5,12 +5,12 @@ declare(strict_types=1); namespace Stancl\Tenancy; use Illuminate\Cache\CacheManager; +use Illuminate\Database\Console\Migrations\FreshCommand; +use Illuminate\Support\ServiceProvider; +use Stancl\Tenancy\Bootstrappers\FilesystemTenancyBootstrapper; use Stancl\Tenancy\Contracts\Domain; use Stancl\Tenancy\Contracts\Tenant; -use Illuminate\Support\ServiceProvider; use Stancl\Tenancy\Resolvers\DomainTenantResolver; -use Illuminate\Database\Console\Migrations\FreshCommand; -use Stancl\Tenancy\Bootstrappers\FilesystemTenancyBootstrapper; class TenancyServiceProvider extends ServiceProvider {