Skip to content

Commit

Permalink
Bind current object to the dynamic relations closure
Browse files Browse the repository at this point in the history
  • Loading branch information
Mehedi Hassan authored and Mehedi Hassan committed Aug 29, 2017
1 parent 33e556f commit 5d1ebbd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Modules/User/Entities/Sentinel/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public function __call($method, $parameters)
if (config()->has($config)) {
$function = config()->get($config);

return $function($this);
return $function->bindTo($this);
}

#i: No relation found, return the call to parent (Eloquent) to handle it.
Expand Down
4 changes: 2 additions & 2 deletions config/asgard/user/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@
| Add relations that will be dynamically added to the User entity
*/
'relations' => [
// 'extension' => function ($self) {
// return $self->belongsTo(UserExtension::class, 'user_id', 'id')->first();
// 'extension' => function () {
// return $this->belongsTo(UserExtension::class, 'user_id', 'id')->first();
// }
],
/*
Expand Down

0 comments on commit 5d1ebbd

Please sign in to comment.