mirror of
https://github.com/archtechx/tenancy.git
synced 2026-06-21 13:44:06 +00:00
958 B
958 B
Resource Syncing Reference
Use this when syncing central resources into tenant contexts.
Source Files
src/ResourceSyncing/*assets/resource-syncing-migrations/*assets/TenancyServiceProvider.stub.php
Setup
Publish resource syncing migration:
php artisan vendor:publish --provider="Stancl\Tenancy\TenancyServiceProvider" --tag=resource-syncing-migrations
php artisan migrate
Main Pieces
tenant_resourcestable.ResourceSyncingclasses and listeners.SyncMaster,Syncable,TenantPivot,TenantMorphPivot.- Events such as
SyncedResourceSaved,SyncedResourceDeleted,CentralResourceAttachedToTenant.
Rules
- Use package events/listeners instead of custom tenant loops.
- Keep central and tenant resource lifecycles explicit.
- Configure soft-delete query behavior in the application
TenancyServiceProviderwhen needed. - Test create, update, delete, restore, attach, and detach behavior.