mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-16 13:04:02 +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:
parent
05f1b2d6f5
commit
e4f5b92485
15 changed files with 217 additions and 96 deletions
|
|
@ -19,30 +19,32 @@ class Run extends Command
|
|||
protected $signature = 'tenants:run {commandname : The artisan command.}
|
||||
{--tenants=* : The tenant(s) to run the command for. Default: all}';
|
||||
|
||||
public function handle(): void
|
||||
public function handle(): int
|
||||
{
|
||||
$argvInput = $this->argvInput();
|
||||
|
||||
tenancy()->runForMultiple($this->getTenants(), function ($tenant) use ($argvInput) {
|
||||
$this->line("Tenant: {$tenant->getTenantKey()}");
|
||||
$this->components->info("Tenant: {$tenant->getTenantKey()}");
|
||||
|
||||
$this->getLaravel()
|
||||
->make(Kernel::class)
|
||||
->handle($argvInput, new ConsoleOutput);
|
||||
});
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
protected function argvInput(): ArgvInput
|
||||
{
|
||||
/** @var string $commandname */
|
||||
$commandname = $this->argument('commandname');
|
||||
/** @var string $commandName */
|
||||
$commandName = $this->argument('commandname');
|
||||
|
||||
// Convert string command to array
|
||||
$subcommand = explode(' ', $commandname);
|
||||
$subCommand = explode(' ', $commandName);
|
||||
|
||||
// Add "artisan" as first parameter because ArgvInput expects "artisan" as first parameter and later removes it
|
||||
array_unshift($subcommand, 'artisan');
|
||||
array_unshift($subCommand, 'artisan');
|
||||
|
||||
return new ArgvInput($subcommand);
|
||||
return new ArgvInput($subCommand);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue