Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions source/docs/v3/tenants.blade.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,20 @@ You may access the current tenant using the `tenant()` helper. You can also pass

Alternatively, you may typehint the `Stancl\Tenancy\Contracts\Tenant` interface to inject the model using the service container.

## Accessing the central application {#accessing-the-central-application}

When your code executes in the context of a tenant, you may access the central application context by using the `tenancy()->central($callback)` function.

For instance, if you want to retrieve the list of users of the central application when the code executes in a tenant's context, you may write:

```php
// Here we are in the tenant's context. User::all() would return the current tenant's users
$centralUsers = tenancy()->central(function () {
// Here we are in the central context
return User::all();
});
```

## Incrementing IDs {#incrementing-ids}

By default, the migration uses `string` for the `id` column, and the model generates UUIDs when you don't supply an `id` during tenant creation.
Expand Down