public function morphTo($name = null, $type = null, $id = null) { if (is_null($name)) { $backtrace = debug_backtrace(false, 4); $caller = $backtrace[3]; $name = snake_case($caller['function']); } return parent::morphTo($name, $type, $id); }
/** * Define an polymorphic, inverse one-to-one or many relationship. * Overridden from {@link Eloquent\Model} to allow the usage of the intermediary methods to handle the relation. * @return \October\Rain\Database\Relations\BelongsTo */ public function morphTo($name = null, $type = null, $id = null) { if (is_null($name)) { $name = snake_case($this->getRelationCaller()); } return parent::morphTo($name, $type, $id); }