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

bug fixes

This commit is contained in:
Samuel Štancl 2019-11-10 11:35:14 +01:00
parent 7cfd4da6ba
commit 9691e358ba
4 changed files with 38 additions and 22 deletions

View file

@ -0,0 +1,29 @@
<?php
declare(strict_types=1);
namespace Stancl\Tenancy\Traits;
use Symfony\Component\Console\Input\InputArgument;
trait HasATenantArgument
{
protected function getArguments()
{
return array_merge([
['tenant', InputArgument::REQUIRED, 'Tenant id', null],
], parent::getArguments());
}
protected function getTenants(): array
{
return [tenancy()->find($this->argument('tenant'))];
}
public function __construct()
{
parent::__construct();
$this->specifyParameters();
}
}

View file

@ -1,22 +0,0 @@
<?php
declare(strict_types=1);
namespace Stancl\Tenancy\Traits;
use Symfony\Component\Console\Input\InputOption;
trait HasATenantOption
{
protected function getOptions()
{
return array_merge([
['tenant', null, InputOption::VALUE_REQUIRED, '', null],
], parent::getOptions());
}
protected function getTenants(): array
{
return tenancy()->all($this->option('tenants'))->all();
}
}

View file

@ -19,4 +19,11 @@ trait HasATenantsOption
{
return tenancy()->all($this->option('tenants'))->all();
}
public function __construct()
{
parent::__construct();
$this->specifyParameters();
}
}

View file

@ -2,6 +2,8 @@
declare(strict_types=1);
namespace Stancl\Tenancy\Traits;
use Stancl\Tenancy\Tenant;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;