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

Add CreatePostgresUserForTenants

This commit is contained in:
lukinovec 2023-04-21 14:35:26 +02:00
parent 54d0ca6a68
commit 64d1333d37
2 changed files with 26 additions and 0 deletions

View 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;
}
}

View file

@ -89,6 +89,7 @@ class TenancyServiceProvider extends ServiceProvider
Commands\MigrateFresh::class, Commands\MigrateFresh::class,
Commands\ClearPendingTenants::class, Commands\ClearPendingTenants::class,
Commands\CreatePendingTenants::class, Commands\CreatePendingTenants::class,
Commands\CreatePostgresUserForTenants::class,
Commands\CreateRLSPoliciesForTenantTables::class, Commands\CreateRLSPoliciesForTenantTables::class,
]); ]);