Skip to main content

Tenancy

Sanvex scopes credentials, driver instances, and some data by owner. This lets a single Laravel app serve multiple users or teams with separate integration credentials.

Global vs tenant scope

CLI setup without owner options stores credentials globally:
Tenant-scoped setup:

Runtime usage

Use for($owner) before resolving a driver:
Global scope is the default:

Owner types

An owner can be:
  • An Eloquent model — owner_type is the model class, owner_id is the primary key
  • Any object implementing Sanvex\Core\Contracts\SanvexOwner
  • Built via Owner::fromTypeAndId($type, $id) or Owner::global()

What gets scoped

When building multi-tenant apps, ensure OAuth callbacks and MCP usage account for owner context in your own application code.