We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f6e3282 commit cc646f1Copy full SHA for cc646f1
src/Inheritance.php
@@ -176,6 +176,22 @@ public function getForeignKey()
176
return Str::snake(class_basename($this->getRootClass())).'_'.$this->getKeyName();
177
}
178
179
+ /**
180
+ * Get the class name for polymorphic relations.
181
+ *
182
+ * @return string
183
+ */
184
+ public function getMorphClass()
185
+ {
186
+ $class = $this->getRootClass();
187
+
188
+ if ($class === static::class) {
189
+ return parent::getMorphClass();
190
+ }
191
192
+ return (new $class)->getMorphClass();
193
194
195
/**
196
* Get the class name of the root class.
197
*
0 commit comments