1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2026-02-05 14:34:04 +00:00
This commit is contained in:
Samuel Štancl 2022-03-30 17:54:34 +02:00
parent f7d0451545
commit 0655ff8a03
4 changed files with 12 additions and 10 deletions

View file

@ -19,11 +19,16 @@ class Migrate extends MigrateCommand
protected $description = 'Run migrations for tenant(s)';
protected static function getTenantCommandName(): string
{
return 'tenants:migrate';
}
public function __construct(Migrator $migrator, Dispatcher $dispatcher)
{
parent::__construct($migrator, $dispatcher);
$this->specifyTenantSignature();
$this->specifyParameters();
}
/**

View file

@ -23,7 +23,7 @@ final class MigrateFresh extends Command
public function __construct()
{
parent::__construct();
$this->addOption('--drop-views', null, InputOption::VALUE_NONE, 'Drop views along with tenant tables.', null);
$this->setName('tenants:migrate-fresh');

View file

@ -16,7 +16,7 @@ class Rollback extends RollbackCommand
{
use HasATenantsOption, DealsWithMigrations, ExtendsLaravelCommand;
protected static function getTenantCommandName()
protected static function getTenantCommandName(): string
{
return 'tenants:rollback';
}

View file

@ -6,21 +6,18 @@ trait ExtendsLaravelCommand
{
protected function specifyTenantSignature(): void
{
$this->setName('tenants:migrate');
$this->specifyParameters();
}
public function getName(): ?string
{
return static::getDefaultName();
return static::getTenantCommandName();
}
public static function getDefaultName(): ?string
{
if (method_exists(static::class, 'getTenantCommandName')) {
return static::getTenantCommandName();
}
return 'tenants:' . parent::getDefaultName();
return static::getTenantCommandName();
}
abstract protected static function getTenantCommandName(): string;
}