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

Clenup for resource syncing

This commit is contained in:
Samuel Štancl 2020-06-01 09:51:22 +02:00
parent 6dad6ce49a
commit da23662d7b
4 changed files with 9 additions and 12 deletions

View file

@ -78,6 +78,11 @@ class TenancyServiceProvider extends ServiceProvider
Events\TenancyBootstrapped::class => [],
Events\RevertingToCentralContext::class => [],
Events\RevertedToCentralContext::class => [],
// Resource syncing
Events\SyncedResourceSaved::class => [
Listeners\UpdateSyncedResource::class,
],
];
}

View file

@ -13,4 +13,6 @@ interface Syncable
public function getCentralModelName(): string;
public function getSyncedAttributeNames(): array;
public function triggerSyncEvent();
}

View file

@ -8,11 +8,6 @@ use Illuminate\Support\Facades\Schema;
class CreateTenantUsersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('tenant_users', function (Blueprint $table) {

View file

@ -117,9 +117,9 @@ class ResourceSyncingTest extends TestCase
// Update user in tenant DB
$user->update([
'name' => 'John Foo', // synced
'email' => 'john@foreignhost', // synced
'role' => 'admin', // unsynced
'name' => 'John Foo', // synceed
'email' => 'john@foreignhost', // synceed
]);
// Assert new values
@ -603,11 +603,6 @@ class CentralUser extends Model implements SyncMaster
return ResourceUser::class;
}
public function getTenantIdColumnInMapTable(): string
{
return 'tenant_id';
}
public function getGlobalIdentifierKey(): string
{
return $this->getAttribute($this->getGlobalIdentifierKeyName());