laravel/framework — pull request #3655 by Ruby184 (2014-02-23 10:14:39+00:00)
Title: Performance improvements of relation name detection

PR for proposal https://github.com/laravel/framework/issues/3567.
- refactored `getBelongsToManyCaller()` to `getRelationCaller()` using `DEBUG_BACKTRACE_IGNORE_ARGS` option and new `$limit` parameter to limit the number of stack frames returned.
- use new method for detection of relation name
- added `$relation` parameter to `morphToMany` and `morphedByMany` methods so it is possible to explicitly pass a relation name
- added `getRelationName()` method to `BelongsTo` and rename property to `$relationName` for consistency with `BelongsToMany`
- fixed tests for `morphTo` and added test for relation name of `belongsTo` relationship

Kind regards, Ruby.