mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-05 17:34:03 +00:00
wip
This commit is contained in:
parent
65b38827d5
commit
19fb4017b7
1 changed files with 58 additions and 0 deletions
58
src/Commands/Run.php
Normal file
58
src/Commands/Run.php
Normal file
|
|
@ -0,0 +1,58 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Stancl\Tenancy\Commands;
|
||||||
|
|
||||||
|
use Illuminate\Console\Command;
|
||||||
|
use Stancl\Tenancy\DatabaseManager;
|
||||||
|
|
||||||
|
class Migrate extends Command
|
||||||
|
{
|
||||||
|
protected $database;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The console command description.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $description = 'Run a command for tenant(s)';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The name and signature of the console command.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $signature = 'tenants:run {command} {--tenants} {args*}';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new command instance.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __construct(DatabaseManager $database)
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
$this->database = $database;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Execute the console command.
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function handle()
|
||||||
|
{
|
||||||
|
if (! $this->confirmToProceed()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
tenant()->all($this->option('tenants'))->each(function ($tenant) {
|
||||||
|
$this->line("Tenant: {$tenant['uuid']} ({$tenant['domain']})");
|
||||||
|
tenancy()->init($tenant['domain']);
|
||||||
|
|
||||||
|
// Run command
|
||||||
|
// todo
|
||||||
|
});
|
||||||
|
|
||||||
|
// todo reconnect to previous tenant or end tenancy if it hadn't been started
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue