mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-12 18:04:03 +00:00
[MINOR BC BREAK] Syncing: PivotWithRelation -> PivotWithCentralResource
The old names of the class and method were misleading. We don't actually need any relation. And we don't even need a model instance as we were returning previously -- the only use of that method was in TriggerSyncingEvents which would immediately use ::class on the returned value. Therefore, all we are asking for in this interface is just the central resource class.
This commit is contained in:
parent
072fcc6326
commit
04a20ca930
6 changed files with 23 additions and 34 deletions
|
|
@ -4,20 +4,13 @@ declare(strict_types=1);
|
|||
|
||||
namespace Stancl\Tenancy\Tests\Etc\ResourceSyncing;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||
use Stancl\Tenancy\ResourceSyncing\PivotWithRelation;
|
||||
use Stancl\Tenancy\ResourceSyncing\PivotWithCentralResource;
|
||||
use Stancl\Tenancy\ResourceSyncing\TenantPivot;
|
||||
|
||||
class CustomPivot extends TenantPivot implements PivotWithRelation
|
||||
class CustomPivot extends TenantPivot implements PivotWithCentralResource
|
||||
{
|
||||
public function users(): BelongsToMany
|
||||
public function getCentralResourceClass(): string
|
||||
{
|
||||
return $this->belongsToMany(CentralUser::class);
|
||||
}
|
||||
|
||||
public function getRelatedModel(): Model
|
||||
{
|
||||
return $this->users()->getModel();
|
||||
return CentralUser::class;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue