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:
parent
04a20ca930
commit
159e600a9b
2 changed files with 50 additions and 1 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue