1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2026-02-05 08:44:04 +00:00

Return value when a single tenant is passed

This commit is contained in:
Samuel Štancl 2019-11-08 16:47:49 +01:00
parent 3d45e835e0
commit 3c05d6bbfe

View file

@ -6,13 +6,22 @@ use Symfony\Component\Console\Output\OutputInterface;
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) {
$tenant->run(function () {
$this->laravel->call([$this, 'handle']);
});
}, $this->getTenants());
}, $tenants);
}
/**