mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-05 02:34:03 +00:00
Add CreatePostgresUserForTenants
This commit is contained in:
parent
54d0ca6a68
commit
64d1333d37
2 changed files with 26 additions and 0 deletions
25
src/Commands/CreatePostgresUserForTenants.php
Normal file
25
src/Commands/CreatePostgresUserForTenants.php
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Stancl\Tenancy\Commands;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
use Stancl\Tenancy\Concerns\HasTenantOptions;
|
||||
use Stancl\Tenancy\Jobs\CreatePostgresUserForTenant;
|
||||
|
||||
class CreatePostgresUserForTenants extends Command
|
||||
{
|
||||
use HasTenantOptions;
|
||||
|
||||
protected $signature = 'tenants:create-postgres-user {--tenants=* : The tenant(s) to run the command for. Default: all}';
|
||||
|
||||
public function handle(): int
|
||||
{
|
||||
tenancy()->runForMultiple($this->getTenants(), function ($tenant) {
|
||||
CreatePostgresUserForTenant::dispatch();
|
||||
});
|
||||
|
||||
return Command::SUCCESS;
|
||||
}
|
||||
}
|
||||
|
|
@ -89,6 +89,7 @@ class TenancyServiceProvider extends ServiceProvider
|
|||
Commands\MigrateFresh::class,
|
||||
Commands\ClearPendingTenants::class,
|
||||
Commands\CreatePendingTenants::class,
|
||||
Commands\CreatePostgresUserForTenants::class,
|
||||
Commands\CreateRLSPoliciesForTenantTables::class,
|
||||
]);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue