Commit 9829d49e authored by Jens Segers's avatar Jens Segers

Updating readme for #75

parent 34ea8120
...@@ -267,8 +267,6 @@ Supported relations are: ...@@ -267,8 +267,6 @@ Supported relations are:
- belongsTo - belongsTo
- belongsToMany - belongsToMany
*The belongsToMany relation will not use a pivot "table", but will push id's to a __related_ids__ attribute instead.*
Example: Example:
use Jenssegers\Mongodb\Model as Eloquent; use Jenssegers\Mongodb\Model as Eloquent;
...@@ -295,6 +293,19 @@ And the inverse relation: ...@@ -295,6 +293,19 @@ And the inverse relation:
} }
The belongsToMany relation will not use a pivot "table", but will push id's to a __related_ids__ attribute instead. This makes the second parameter for the belongsToMany method useless. If you want to define custom keys for your relation, set it to `null`:
use Jenssegers\Mongodb\Model as Eloquent;
class User extends Eloquent {
public function groups()
{
return $this->belongsToMany('Group', null, 'users', 'groups');
}
}
Other relations are not yet supported, but may be added in the future. Read more about these relations on http://four.laravel.com/docs/eloquent#relationships Other relations are not yet supported, but may be added in the future. Read more about these relations on http://four.laravel.com/docs/eloquent#relationships
### Raw Expressions ### Raw Expressions
......
...@@ -9,6 +9,6 @@ class Group extends Eloquent { ...@@ -9,6 +9,6 @@ class Group extends Eloquent {
public function users() public function users()
{ {
return $this->belongsToMany('User', 'test_collection', 'groups', 'users'); return $this->belongsToMany('User', null, 'groups', 'users');
} }
} }
...@@ -35,7 +35,7 @@ class User extends Eloquent implements UserInterface, RemindableInterface { ...@@ -35,7 +35,7 @@ class User extends Eloquent implements UserInterface, RemindableInterface {
public function groups() public function groups()
{ {
return $this->belongsToMany('Group', 'test_collection', 'users', 'groups'); return $this->belongsToMany('Group', null, 'users', 'groups');
} }
/** /**
......
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