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:
parent
b7c8f1fba7
commit
a756b9b3bc
8 changed files with 224 additions and 58 deletions
|
|
@ -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();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue