mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-05 11:44:04 +00:00
Return value when a single tenant is passed
This commit is contained in:
parent
3d45e835e0
commit
3c05d6bbfe
1 changed files with 11 additions and 2 deletions
|
|
@ -6,13 +6,22 @@ use Symfony\Component\Console\Output\OutputInterface;
|
||||||
|
|
||||||
trait TenantAwareCommand
|
trait TenantAwareCommand
|
||||||
{
|
{
|
||||||
protected function execute(InputInterface $input, OutputInterface $output): void
|
/** @return mixed|void */
|
||||||
|
protected function execute(InputInterface $input, OutputInterface $output)
|
||||||
{
|
{
|
||||||
|
$tenants = $this->getTenants();
|
||||||
|
|
||||||
|
if (count($tenants) === 1) {
|
||||||
|
return $tenants[0]->run(function () {
|
||||||
|
return $this->laravel->call([$this, 'handle']);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
array_map(function (Tenant $tenant) {
|
array_map(function (Tenant $tenant) {
|
||||||
$tenant->run(function () {
|
$tenant->run(function () {
|
||||||
$this->laravel->call([$this, 'handle']);
|
$this->laravel->call([$this, 'handle']);
|
||||||
});
|
});
|
||||||
}, $this->getTenants());
|
}, $tenants);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue