1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2025-12-17 00:54:04 +00:00

[4.x] Update commands CLI outputs (#968)

* Using laravel components

* Ensure commands returns success

* update tests

* clean

* bump EndBug version

* Update ci.yml

* Update ci.yml

* Update ci.yml

* revert CI changes

* Update ci.yml

* Update ci.yml

* Update ci.yml

* revert CI changes to it's original state

* fix typos, improve code

* improve Install & TenantList commands

* php-cs-fixer

* type GitHub properly

Co-authored-by: Abrar Ahmad <abrar.dev99@gmail.com>
Co-authored-by: Samuel Štancl <samuel@archte.ch>
Co-authored-by: Samuel Štancl <samuel.stancl@gmail.com>
This commit is contained in:
Jori Stein 2022-10-18 13:11:57 -04:00 committed by GitHub
parent 05f1b2d6f5
commit e4f5b92485
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 217 additions and 96 deletions

View file

@ -4,7 +4,6 @@ declare(strict_types=1);
namespace Stancl\Tenancy\Commands;
use Illuminate\Console\Command;
use Illuminate\Contracts\Events\Dispatcher;
use Illuminate\Database\ConnectionResolverInterface;
use Illuminate\Database\Console\DumpCommand;
@ -22,13 +21,6 @@ class TenantDump extends DumpCommand
}
public function handle(ConnectionResolverInterface $connections, Dispatcher $dispatcher): int
{
$this->tenant()->run(fn () => parent::handle($connections, $dispatcher));
return Command::SUCCESS;
}
public function tenant(): Tenant
{
$tenant = $this->option('tenant')
?? tenant()
@ -39,9 +31,15 @@ class TenantDump extends DumpCommand
$tenant = tenancy()->find($tenant);
}
throw_if(! $tenant, 'Could not identify the tenant to use for dumping the schema.');
if ($tenant === null) {
$this->components->error('Could not find tenant to use for dumping the schema.');
return $tenant;
return 1;
}
parent::handle($connections, $dispatcher);
return 0;
}
protected function getOptions(): array