1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2025-12-12 22:14:03 +00:00

Implement changes from review on GH

This commit is contained in:
Samuel Štancl 2020-05-13 00:31:30 +02:00
parent b7c8f1fba7
commit a756b9b3bc
8 changed files with 224 additions and 58 deletions

View file

@ -3,13 +3,18 @@
namespace Stancl\Tenancy\Database\Models;
use Illuminate\Database\Eloquent\Relations\Pivot;
use Stancl\Tenancy\Contracts\Syncable;
class TenantPivot extends Pivot
{
public static function booted()
{
static::saved(function (self $pivot) {
$pivot->pivotParent->triggerSyncEvent();
$parent = $pivot->pivotParent;
if ($parent instanceof Syncable) {
$parent->triggerSyncEvent();
}
});
}
}