diff --git a/src/Illuminate/Database/Eloquent/Model.php b/src/Illuminate/Database/Eloquent/Model.php index e876eca6372c..95dbac0eaf18 100755 --- a/src/Illuminate/Database/Eloquent/Model.php +++ b/src/Illuminate/Database/Eloquent/Model.php @@ -786,7 +786,7 @@ public function belongsTo($related, $foreignKey = null, $otherKey = null, $relat // of the time this will be what we desire to use for the relationships. if (is_null($relation)) { - list(, $caller) = debug_backtrace(false); + list(, $caller) = debug_backtrace(false, 2); $relation = $caller['function']; } @@ -826,7 +826,7 @@ public function morphTo($name = null, $type = null, $id = null) // use that to get both the class and foreign key that will be utilized. if (is_null($name)) { - list(, $caller) = debug_backtrace(false); + list(, $caller) = debug_backtrace(false, 2); $name = snake_case($caller['function']); }