mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-12 23:34:03 +00:00
Synced resources - proof of concept
This commit is contained in:
parent
86a98b2bc8
commit
daae67c0f7
8 changed files with 393 additions and 0 deletions
16
src/Database/Models/Concerns/ResourceSyncing.php
Normal file
16
src/Database/Models/Concerns/ResourceSyncing.php
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
<?php
|
||||
|
||||
namespace Stancl\Tenancy\Database\Models\Concerns;
|
||||
|
||||
use Stancl\Tenancy\Contracts\Syncable;
|
||||
use Stancl\Tenancy\Events\SyncedResourceSaved;
|
||||
|
||||
trait ResourceSyncing
|
||||
{
|
||||
public static function bootResourceSyncing()
|
||||
{
|
||||
static::saving(function (Syncable $model) {
|
||||
event(new SyncedResourceSaved($model, tenant()));
|
||||
});
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue