mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-12 08:04:03 +00:00
Also move pivot record deletion to that listener and improve tests The 'tenant pivot records are deleted along with the tenants to which they belong to' test is failing in this commit -- the listener for deleting mappings when a *tenant* is deleted is only implemented in the next commit. The only change done here is to re-add FKs (necessary for passing *in this commit* in that specific dataset variant) that were removed from the default test migration as we now have the DeleteResourceMapping listener that's enabled by default.
29 lines
810 B
PHP
29 lines
810 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Stancl\Tenancy\ResourceSyncing;
|
|
|
|
use Illuminate\Database\Eloquent\Collection;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
|
use Stancl\Tenancy\Database\Contracts\TenantWithDatabase;
|
|
|
|
/**
|
|
* @property-read TenantWithDatabase[]|Collection<int, TenantWithDatabase&Model> $tenants
|
|
*/
|
|
interface SyncMaster extends Syncable
|
|
{
|
|
/**
|
|
* @return BelongsToMany<TenantWithDatabase&Model, self&Model>
|
|
*/
|
|
public function tenants(): BelongsToMany;
|
|
|
|
public function getTenantModelName(): string;
|
|
|
|
public function triggerDetachEvent(TenantWithDatabase&Model $tenant): void;
|
|
|
|
public function triggerAttachEvent(TenantWithDatabase&Model $tenant): void;
|
|
|
|
public function triggerRestoreEvent(): void;
|
|
}
|