query->where($this->getOwnerKey(), '=', $this->parent->{$this->foreignKey}); } } /** * @inheritdoc */ protected function getResultsByType($type) { $instance = $this->createModelByType($type); $key = $instance->getKeyName(); $query = $instance->newQuery(); return $query->whereIn($key, $this->gatherKeysByType($type))->get(); } /** * Get the owner key with backwards compatible support. * * @return string */ public function getOwnerKey() { return property_exists($this, 'ownerKey') ? $this->ownerKey : $this->otherKey; } }