Skip to content

Commit 5ba231a

Browse files
committed
Making progress on fixing relations
1 parent 924837f commit 5ba231a

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/Jenssegers/Mongodb/Relations/HasMany.php

+10
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,16 @@
55

66
class HasMany extends EloquentHasMany
77
{
8+
/**
9+
* Get the plain foreign key.
10+
*
11+
* @return string
12+
*/
13+
public function getForeignKeyName()
14+
{
15+
return $this->foreignKey;
16+
}
17+
818
/**
919
* Get the key for comparing against the parent key in "has" query.
1020
*

tests/models/Client.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@ public function photo()
1919

2020
public function addresses()
2121
{
22-
return $this->hasMany('Address', 'data.address_id', 'data.client_id');
22+
return $this->hasMany('Address', 'data.client_id', 'data.client_id');
2323
}
2424
}

0 commit comments

Comments
 (0)