mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-12 12:24:04 +00:00
Clenup for resource syncing
This commit is contained in:
parent
6dad6ce49a
commit
da23662d7b
4 changed files with 9 additions and 12 deletions
|
|
@ -78,6 +78,11 @@ class TenancyServiceProvider extends ServiceProvider
|
||||||
Events\TenancyBootstrapped::class => [],
|
Events\TenancyBootstrapped::class => [],
|
||||||
Events\RevertingToCentralContext::class => [],
|
Events\RevertingToCentralContext::class => [],
|
||||||
Events\RevertedToCentralContext::class => [],
|
Events\RevertedToCentralContext::class => [],
|
||||||
|
|
||||||
|
// Resource syncing
|
||||||
|
Events\SyncedResourceSaved::class => [
|
||||||
|
Listeners\UpdateSyncedResource::class,
|
||||||
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,4 +13,6 @@ interface Syncable
|
||||||
public function getCentralModelName(): string;
|
public function getCentralModelName(): string;
|
||||||
|
|
||||||
public function getSyncedAttributeNames(): array;
|
public function getSyncedAttributeNames(): array;
|
||||||
|
|
||||||
|
public function triggerSyncEvent();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,11 +8,6 @@ use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
class CreateTenantUsersTable extends Migration
|
class CreateTenantUsersTable extends Migration
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* Run the migrations.
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function up()
|
public function up()
|
||||||
{
|
{
|
||||||
Schema::create('tenant_users', function (Blueprint $table) {
|
Schema::create('tenant_users', function (Blueprint $table) {
|
||||||
|
|
|
||||||
|
|
@ -117,9 +117,9 @@ class ResourceSyncingTest extends TestCase
|
||||||
|
|
||||||
// Update user in tenant DB
|
// Update user in tenant DB
|
||||||
$user->update([
|
$user->update([
|
||||||
|
'name' => 'John Foo', // synced
|
||||||
|
'email' => 'john@foreignhost', // synced
|
||||||
'role' => 'admin', // unsynced
|
'role' => 'admin', // unsynced
|
||||||
'name' => 'John Foo', // synceed
|
|
||||||
'email' => 'john@foreignhost', // synceed
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// Assert new values
|
// Assert new values
|
||||||
|
|
@ -603,11 +603,6 @@ class CentralUser extends Model implements SyncMaster
|
||||||
return ResourceUser::class;
|
return ResourceUser::class;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getTenantIdColumnInMapTable(): string
|
|
||||||
{
|
|
||||||
return 'tenant_id';
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getGlobalIdentifierKey(): string
|
public function getGlobalIdentifierKey(): string
|
||||||
{
|
{
|
||||||
return $this->getAttribute($this->getGlobalIdentifierKeyName());
|
return $this->getAttribute($this->getGlobalIdentifierKeyName());
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue