stancl / tenancy-docs

stancl/tenancy docs & website
https://tenancyforlaravel.com/docs
MIT License
66 stars 636 forks source link

Take action once the tenant has been created. #255

Closed mohammed-kabbani closed 1 year ago

mohammed-kabbani commented 1 year ago

Greetings,

Upon successfully generating a tenant and model using the following code:

$tenant = Tenant::create(['id' => $tenantName]);
$tenant->domains()->create(['domain' => $tenantDomain]);

I aim to implement an Observer for further actions. For instance, once this tenant is created, the subsequent operations will be executed:


$client = new ClientRepository();
$client->createPasswordGrantClient(null, 'Default password grant client', 'http://localhost');
$client->createPersonalAccessClient(null, 'Default personal access client', 'http://localhost');

also, other tasks like setting up a default/demo user can also be performed at this stage.

*note: when I do that with an observer or directly on the tenant tables, nothing happens

stancl commented 1 year ago

Not a docs issue, use the right support channels such as our Discord.