mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-13 08:24:04 +00:00
* wip * bump jobpipeline dependency * bump pest dependency * fix composer.json syntax * minor changes to docker setup * more docker changes * compact pest output, remove unnecessary env vars from composer.json * minor pest tweaks * mssql fix * try enabling colors in CI * try setting --columns=max for pest in CI * try setting columns using env var instead of --columns in CI * Revert "try setting columns using env var instead of --columns in CI" This reverts commit eb3c177aefa97b0a3140d7f0e89c5012a854ff42. * replace --compact with --no-progress * try setting a hardcoded columns value in CI * remove --columns (doesn't work), add back --compact * try setting COLUMNS to a hardcoded value in CI * remove alternative env syntax from CI * fix PrefixCacheBootstrapperTest on L11, skip on L10 * add one more skip() call * fix validate.yml * Simplify schema dump, skip dump-related tests in L10 * Rename 'dump' table to 'example' * Bring schema dump-related tests together, add comments * Merge schema path-related tests into one, add comments * Rename dataset parameter --------- Co-authored-by: lukinovec <lukinovec@gmail.com>
37 lines
872 B
PHP
37 lines
872 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Stancl\Tenancy\Concerns;
|
|
|
|
use Stancl\Tenancy\Contracts\Tenant;
|
|
use Symfony\Component\Console\Input\InputInterface;
|
|
use Symfony\Component\Console\Output\OutputInterface;
|
|
|
|
trait TenantAwareCommand
|
|
{
|
|
protected function execute(InputInterface $input, OutputInterface $output): int
|
|
{
|
|
$tenants = $this->getTenants();
|
|
$exitCode = 0;
|
|
|
|
foreach ($tenants as $tenant) {
|
|
$result = (int) $tenant->run(function () {
|
|
return $this->laravel->call([$this, 'handle']);
|
|
});
|
|
|
|
if ($result !== 0) {
|
|
$exitCode = $result;
|
|
}
|
|
}
|
|
|
|
return $exitCode;
|
|
}
|
|
|
|
/**
|
|
* Get an array of tenants for which the command should be executed.
|
|
*
|
|
* @return Tenant[]|mixed
|
|
*/
|
|
abstract protected function getTenants();
|
|
}
|