Commit 2b132512 by Taylor Otwell

Add comment regarding foreign and associated keys in eloquent.

parent dd729886
......@@ -285,6 +285,8 @@ abstract class Eloquent {
$this->relating_table = $table;
}
// Allowing the overriding of the foreign and associated keys provides the flexibility for
// self-referential many-to-many relationships, such as a "buddy list".
$this->relating_key = (is_null($foreign_key)) ? strtolower(get_class($this)).'_id' : $foreign_key;
$associated_key = (is_null($associated_key)) ? strtolower($model).'_id' : $associated_key;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment