integrated frontend

This commit is contained in:
jack
2018-05-07 15:26:23 +08:00
parent a5534004b8
commit a1db64d1c1
210 changed files with 26173 additions and 55949 deletions
+43 -6
View File
@@ -5,6 +5,7 @@ namespace App;
use Tymon\JWTAuth\Contracts\JWTSubject;
use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;
use App\Notifications\ResetPassword as ResetPasswordNotification;
class User extends Authenticatable implements JWTSubject
{
@@ -16,7 +17,7 @@ class User extends Authenticatable implements JWTSubject
* @var array
*/
protected $fillable = [
'name', 'email', 'password',
'name', 'email', 'password',
];
/**
@@ -29,22 +30,58 @@ class User extends Authenticatable implements JWTSubject
];
/**
* Get the identifier that will be stored in the subject claim of the JWT.
* The accessors to append to the model's array form.
*
* @return mixed
* @var array
*/
protected $appends = [
'photo_url',
];
/**
* Get the profile photo URL attribute.
*
* @return string
*/
public function getPhotoUrlAttribute()
{
return 'https://www.gravatar.com/avatar/'.md5(strtolower($this->email)).'.jpg?s=200&d=mm';
}
/**
* Get the oauth providers.
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function oauthProviders()
{
return $this->hasMany(OAuthProvider::class);
}
/**
* Send the password reset notification.
*
* @param string $token
* @return void
*/
public function sendPasswordResetNotification($token)
{
$this->notify(new ResetPasswordNotification($token));
}
/**
* @return int
*/
public function getJWTIdentifier()
{
return $this->getKey();
}
/**
* Return a key value array, containing any custom claims to be added to the JWT.
*
* @return array
*/
public function getJWTCustomClaims()
{
return [];
}
}