Commit 5d1ebbda authored by Mehedi Hassan's avatar Mehedi Hassan

Bind current object to the dynamic relations closure

parent 33e556f1
...@@ -114,7 +114,7 @@ class User extends EloquentUser implements UserInterface, AuthenticatableContrac ...@@ -114,7 +114,7 @@ class User extends EloquentUser implements UserInterface, AuthenticatableContrac
if (config()->has($config)) { if (config()->has($config)) {
$function = config()->get($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. #i: No relation found, return the call to parent (Eloquent) to handle it.
......
...@@ -85,8 +85,8 @@ return [ ...@@ -85,8 +85,8 @@ return [
| Add relations that will be dynamically added to the User entity | Add relations that will be dynamically added to the User entity
*/ */
'relations' => [ 'relations' => [
// 'extension' => function ($self) { // 'extension' => function () {
// return $self->belongsTo(UserExtension::class, 'user_id', 'id')->first(); // 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