mirror of
https://github.com/archtechx/tenancy.git
synced 2026-06-21 01:54:03 +00:00
741 B
741 B
User Impersonation Reference
Use this when implementing tenant user impersonation.
Source Files
src/Features/UserImpersonation.phpsrc/Database/Models/ImpersonationToken.phpassets/impersonation-migrations/*
Setup
php artisan vendor:publish --provider="Stancl\Tenancy\TenancyServiceProvider" --tag=impersonation-migrations
php artisan migrate
Enable feature:
'features' => [
Stancl\Tenancy\Features\UserImpersonation::class,
],
Command
php artisan tenants:purge-impersonation-tokens
Rules
- Verify tenant match before logging in impersonated users.
- Test guard, redirect URL, remember flag, token TTL, and invalid token behavior.
- Purge expired tokens routinely.