0

I am looking for a way to manage all tenant users (users inside every tenant database) from the Stancl/Tenancy central domain.

When I am on the central domain, the app is connected to the landlord DB. My expectation is to be able to create the user and store it in the chosen tenant database. PS: I am using PostgreSQL with schemas instead of separated DB.

1 Answers1

2

The way I achieve it is:

  1. Either you switch to tenant context and run your commands afterwards:

$tenant = Tenant::find('some-id');

tenancy()->initialize($tenant);

// create your user for tenant here

  1. After finding the tenant, run your commands for the tenant like: $tenant->run(function(){ // your code to create users here })