1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2026-08-06 23:14:04 +00:00

Merge branch 'master' into scope-cache-fix

This commit is contained in:
lukinovec 2026-08-05 11:45:02 +02:00 committed by GitHub
commit c0ac3382e0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 17 additions and 9 deletions

View file

@ -16,9 +16,7 @@ class Run extends Command
protected $description = 'Run a command for tenant(s)'; protected $description = 'Run a command for tenant(s)';
protected $signature = 'tenants:run {commandname : The artisan command.} protected $signature = 'tenants:run {commandname : The artisan command.}';
{--tenants=* : The tenant(s) to run the command for. Default: all}
{--skip-tenants=* : The tenant(s) to skip}';
public function handle(): int public function handle(): int
{ {

View file

@ -16,11 +16,21 @@ class Seed extends SeedCommand
protected $description = 'Seed tenant database(s).'; protected $description = 'Seed tenant database(s).';
protected $name = 'tenants:seed';
public function __construct(ConnectionResolverInterface $resolver) public function __construct(ConnectionResolverInterface $resolver)
{ {
parent::__construct($resolver); // See https://github.com/archtechx/tenancy/issues/1474
if (version_compare(app()->version(), '13.24.0', '>=')) {
$this->signature = 'tenants:seed
{class? : The class name of the root seeder}
{--class=Database\\Seeders\\DatabaseSeeder : The class name of the root seeder}
{--database= : The database connection to seed}
{--force : Force the operation to run when in production}';
parent::__construct($resolver);
$this->specifyParameters();
} else {
$this->name = 'tenants:seed';
parent::__construct($resolver);
}
} }
public function handle(): int public function handle(): int

View file

@ -55,9 +55,9 @@ trait HasTenantOptions
}); });
} }
public function __construct() public function __construct(mixed ...$args)
{ {
parent::__construct(); parent::__construct(...$args);
$this->specifyParameters(); $this->specifyParameters();
} }

View file

@ -103,7 +103,7 @@ class TenancyServiceProvider extends ServiceProvider
$config['connection'] ??= $centralConnection; $config['connection'] ??= $centralConnection;
/** @var CacheManager $this */ /** @var CacheManager $this */
return $this->createDatabaseDriver($config); // @phpstan-ignore method.protected return $this->createDatabaseDriver($config);
}); });
// DatabaseCacheBootstrapper explicitly writes 'tenant' into each store's 'connection' // DatabaseCacheBootstrapper explicitly writes 'tenant' into each store's 'connection'