I've seen the example in the documentation but it's between 3 tables. I have Cart2s and a Prodbranch table, both have these 2 fields: branchid and prodid. and i want them to match.
I'm trying to do such relation in my Cart2s Model like this:
public function prodbranches(){
return $this->hasManyDeep(Prodbranch::class, [new CompositeKey('prodid', 'branchid')]);
}
however i'm getting this error:
TypeError: preg_split(): Argument #2 ($subject) must be of type string, Staudenmeir\EloquentHasManyDeep\Eloquent\CompositeKey given in file xxxx/vendor/staudenmeir/eloquent-has-many-deep/src/HasRelationships.php on line 82
I also tried this:
public function prodbranches(){
return $this->hasManyDeep(Prodbranch::class, [new CompositeKey('prodid', 'branchid'), 'id']);
}
I've seen the example in the documentation but it's between 3 tables. I have Cart2s and a Prodbranch table, both have these 2 fields: branchid and prodid. and i want them to match. I'm trying to do such relation in my Cart2s Model like this:
however i'm getting this error:
TypeError: preg_split(): Argument #2 ($subject) must be of type string, Staudenmeir\EloquentHasManyDeep\Eloquent\CompositeKey given in file xxxx/vendor/staudenmeir/eloquent-has-many-deep/src/HasRelationships.php on line 82
I also tried this:
Am i doing something wrong?