mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-05 05:44:04 +00:00
bug fixes
This commit is contained in:
parent
7cfd4da6ba
commit
9691e358ba
4 changed files with 38 additions and 22 deletions
29
src/Traits/HasATenantArgument.php
Normal file
29
src/Traits/HasATenantArgument.php
Normal 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();
|
||||
}
|
||||
}
|
||||
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
@ -19,4 +19,11 @@ trait HasATenantsOption
|
|||
{
|
||||
return tenancy()->all($this->option('tenants'))->all();
|
||||
}
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->specifyParameters();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue