added seeder

added user to return role
This commit is contained in:
jack
2018-05-07 17:38:31 +08:00
parent 3373524bc1
commit 8da0cbceec
7 changed files with 238 additions and 20 deletions
+12 -1
View File
@@ -38,7 +38,7 @@ class User extends Authenticatable implements JWTSubject
* @var array
*/
protected $appends = [
'photo_url',
'photo_url', 'role'
];
/**
@@ -51,6 +51,16 @@ class User extends Authenticatable implements JWTSubject
return 'https://www.gravatar.com/avatar/'.md5(strtolower($this->email)).'.jpg?s=200&d=mm';
}
/**
* Get the role attribute.
*
* @return string
*/
public function getRoleAttribute()
{
return $this->roles->first()->name;
}
/**
* Get the oauth providers.
*
@@ -87,4 +97,5 @@ class User extends Authenticatable implements JWTSubject
{
return [];
}
}