1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2026-02-04 12:34:03 +00:00

Syncing: support morph maps in TriggerSyncingEvents

This commit is contained in:
lukinovec 2025-12-01 10:28:58 +01:00 committed by Samuel Stancl
parent 04a20ca930
commit 159e600a9b
2 changed files with 50 additions and 1 deletions

View file

@ -7,6 +7,7 @@ namespace Stancl\Tenancy\ResourceSyncing;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\MorphPivot;
use Illuminate\Database\Eloquent\Relations\Pivot;
use Illuminate\Database\Eloquent\Relations\Relation;
use Stancl\Tenancy\Contracts\Tenant;
use Stancl\Tenancy\Database\Contracts\TenantWithDatabase;
@ -85,7 +86,7 @@ trait TriggerSyncingEvents
}
if ($this instanceof MorphPivot) {
return $this->morphClass;
return Relation::getMorphedModel($this->morphClass) ?? $this->morphClass;
}
throw new CentralResourceNotAvailableInPivotException;