mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-06 12:34:03 +00:00
adjust tests
This commit is contained in:
parent
8c81ef2a8d
commit
f9dc4cb8e0
3 changed files with 53 additions and 60 deletions
|
|
@ -4,8 +4,11 @@ declare(strict_types=1);
|
|||
|
||||
namespace Stancl\Tenancy\Database\Concerns;
|
||||
|
||||
use Illuminate\Database\Eloquent\Relations\MorphToMany;
|
||||
use Stancl\Tenancy\Contracts\Syncable;
|
||||
use Stancl\Tenancy\Contracts\UniqueIdentifierGenerator;
|
||||
use Stancl\Tenancy\Database\Models\Tenant;
|
||||
use Stancl\Tenancy\Database\Models\TenantPivot;
|
||||
use Stancl\Tenancy\Events\SyncedResourceSaved;
|
||||
|
||||
trait ResourceSyncing
|
||||
|
|
@ -43,4 +46,15 @@ trait ResourceSyncing
|
|||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function resources(): MorphToMany
|
||||
{
|
||||
return $this->morphToMany($this->getResourceTenantModelName(), 'tenant_resources', 'tenant_resources', 'resource_global_id', 'tenant_id', 'global_id')
|
||||
->using(TenantPivot::class);
|
||||
}
|
||||
|
||||
public function getResourceTenantModelName(): string // todo better name
|
||||
{
|
||||
return config('tenancy.tenant_model', Tenant::class);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue