mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-05 18:34:04 +00:00
remove docblocks, fix tenant() logic
This commit is contained in:
parent
4f5231b0a9
commit
911b0e3cbd
1 changed files with 3 additions and 26 deletions
|
|
@ -13,9 +13,6 @@ use Symfony\Component\Console\Input\InputOption;
|
||||||
|
|
||||||
class TenantDump extends DumpCommand
|
class TenantDump extends DumpCommand
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* Create a new command instance.
|
|
||||||
*/
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
|
|
@ -24,15 +21,7 @@ class TenantDump extends DumpCommand
|
||||||
$this->specifyParameters();
|
$this->specifyParameters();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Execute the console command.
|
|
||||||
*
|
|
||||||
* @param \Illuminate\Database\ConnectionResolverInterface $connections
|
|
||||||
* @param \Illuminate\Contracts\Events\Dispatcher $dispatcher
|
|
||||||
* @return int
|
|
||||||
*
|
|
||||||
* @throws \Throwable
|
|
||||||
*/
|
|
||||||
public function handle(ConnectionResolverInterface $connections, Dispatcher $dispatcher): int
|
public function handle(ConnectionResolverInterface $connections, Dispatcher $dispatcher): int
|
||||||
{
|
{
|
||||||
$this->tenant()->run(fn() => parent::handle($connections, $dispatcher));
|
$this->tenant()->run(fn() => parent::handle($connections, $dispatcher));
|
||||||
|
|
@ -40,19 +29,12 @@ class TenantDump extends DumpCommand
|
||||||
return Command::SUCCESS;
|
return Command::SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get tenant to use as a template for the schema dump.
|
|
||||||
*
|
|
||||||
* @return \Stancl\Tenancy\Contracts\Tenant
|
|
||||||
*
|
|
||||||
* @throws \Throwable
|
|
||||||
*/
|
|
||||||
public function tenant(): Tenant
|
public function tenant(): Tenant
|
||||||
{
|
{
|
||||||
$tenant = $this->option('tenant')
|
$tenant = $this->option('tenant')
|
||||||
?? tenant()
|
?? tenant()
|
||||||
?? tenancy()->query()->first()
|
?? $this->ask('What tenant do you want to dump the schema for?')
|
||||||
?? $this->ask('What tenant do you want to dump the schema for?');
|
?? tenancy()->query()->first();
|
||||||
|
|
||||||
if (! $tenant instanceof Tenant) {
|
if (! $tenant instanceof Tenant) {
|
||||||
$tenant = tenancy()->find($tenant);
|
$tenant = tenancy()->find($tenant);
|
||||||
|
|
@ -63,11 +45,6 @@ class TenantDump extends DumpCommand
|
||||||
return $tenant;
|
return $tenant;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the console command options.
|
|
||||||
*
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
protected function getOptions(): array
|
protected function getOptions(): array
|
||||||
{
|
{
|
||||||
return array_merge([
|
return array_merge([
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue