X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/43d9d2eba76528dc1bcaccb6896b110faa920cff..refs/pull/255/head:/app/User.php diff --git a/app/User.php b/app/User.php index 32449971d..09b189cbb 100644 --- a/app/User.php +++ b/app/User.php @@ -1,13 +1,16 @@ 'guest', - 'name' => 'Guest' - ]); + return static::where('system_name', '=', 'public')->first(); + } + + /** + * Check if the user is the default public user. + * @return bool + */ + public function isDefault() + { + return $this->system_name === 'public'; } /** * The roles that belong to the user. + * @return BelongsToMany */ public function roles() { + if ($this->id === 0) return ; return $this->belongsToMany(Role::class); } @@ -183,4 +195,14 @@ class User extends Model implements AuthenticatableContract, CanResetPasswordCon return ''; } + + /** + * Send the password reset notification. + * @param string $token + * @return void + */ + public function sendPasswordResetNotification($token) + { + $this->notify(new ResetPassword($token)); + } }