mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-05 21:14:03 +00:00
wip
This commit is contained in:
parent
f7d0451545
commit
0655ff8a03
4 changed files with 12 additions and 10 deletions
|
|
@ -19,11 +19,16 @@ class Migrate extends MigrateCommand
|
||||||
|
|
||||||
protected $description = 'Run migrations for tenant(s)';
|
protected $description = 'Run migrations for tenant(s)';
|
||||||
|
|
||||||
|
protected static function getTenantCommandName(): string
|
||||||
|
{
|
||||||
|
return 'tenants:migrate';
|
||||||
|
}
|
||||||
|
|
||||||
public function __construct(Migrator $migrator, Dispatcher $dispatcher)
|
public function __construct(Migrator $migrator, Dispatcher $dispatcher)
|
||||||
{
|
{
|
||||||
parent::__construct($migrator, $dispatcher);
|
parent::__construct($migrator, $dispatcher);
|
||||||
|
|
||||||
$this->specifyTenantSignature();
|
$this->specifyParameters();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ class Rollback extends RollbackCommand
|
||||||
{
|
{
|
||||||
use HasATenantsOption, DealsWithMigrations, ExtendsLaravelCommand;
|
use HasATenantsOption, DealsWithMigrations, ExtendsLaravelCommand;
|
||||||
|
|
||||||
protected static function getTenantCommandName()
|
protected static function getTenantCommandName(): string
|
||||||
{
|
{
|
||||||
return 'tenants:rollback';
|
return 'tenants:rollback';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,21 +6,18 @@ trait ExtendsLaravelCommand
|
||||||
{
|
{
|
||||||
protected function specifyTenantSignature(): void
|
protected function specifyTenantSignature(): void
|
||||||
{
|
{
|
||||||
$this->setName('tenants:migrate');
|
|
||||||
$this->specifyParameters();
|
$this->specifyParameters();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName(): ?string
|
public function getName(): ?string
|
||||||
{
|
{
|
||||||
return static::getDefaultName();
|
return static::getTenantCommandName();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getDefaultName(): ?string
|
public static function getDefaultName(): ?string
|
||||||
{
|
{
|
||||||
if (method_exists(static::class, 'getTenantCommandName')) {
|
|
||||||
return static::getTenantCommandName();
|
return static::getTenantCommandName();
|
||||||
}
|
}
|
||||||
|
|
||||||
return 'tenants:' . parent::getDefaultName();
|
abstract protected static function getTenantCommandName(): string;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue