Commit 62efe73a authored by Nicolas Widart's avatar Nicolas Widart Committed by GitHub

Merge pull request #367 from MehediDracula/2.0

Bind current object to the dynamic relations closure
parents 33e556f1 cb33f8c4
......@@ -113,8 +113,9 @@ class User extends EloquentUser implements UserInterface, AuthenticatableContrac
#i: Relation method resolver
if (config()->has($config)) {
$function = config()->get($config);
return $function($this);
$bound = $function->bindTo($this);
return $bound();
}
#i: No relation found, return the call to parent (Eloquent) to handle it.
......
......@@ -85,8 +85,8 @@ return [
| 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();
// }
],
/*
......
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