Skip to content

v3.6.7

This is needed since the previous query used with multisite would return duplicate keys, eg: [1,2,2,2,2,2] since it joined in shared relations (scopes and other constraints were not applied to this query). This would cause integrity violations in the database when saving the duplicates. We looked at adding the following additional constraint:

```php
protected function applyMultisiteConstraint()
{
    $model = $this->related;
    if (
        $model &&
        $model->isClassInstanceOf(\October\Contracts\Database\MultisiteInterface::class) &&
        $model->isMultisiteEnabled() &&
        !Site::hasGlobalContext()
    ) {
        $this->where($model->getQualifiedSiteIdColumn(), Site::getSiteIdFromContext());
    }
}
```

However, this is getting too complicated now. The Laravel query just hits the join table and we researched why deferred binding was needed in the first place...

- 58f1b1c6ab741d45b17aa63589aff81cf572948c: Added deferred binding to simple value lookup since it was needed for validation

- 1828fbb39debb3336e8e92e7a540cc80edf08fa9: Removed the use of simple value in validation for nested attribute validation

- b0329f2a68bdf5c601a3facb49da578bccc77180: Added deferred binding to the validation lookup itself

Yet the unused logic still remains. Internally, we can use the much simpler logic found in Laravel instead. Externally, the equivalent functionality is found with a `withDeferred()->pluck('id')->all()` call.
Assets 2