]> BookStack Code Mirror - bookstack/blobdiff - app/User.php
Updated all application urls to allow path prefix.
[bookstack] / app / User.php
index 1ba5b90f344b4618d72d839da08c46b8229df999..32449971d7847f8e4d0dc880d3868fd8eb2c528a 100644 (file)
@@ -49,7 +49,7 @@ class User extends Model implements AuthenticatableContract, CanResetPasswordCon
      */
     public function roles()
     {
-        return $this->belongsToMany('BookStack\Role');
+        return $this->belongsToMany(Role::class);
     }
 
     /**
@@ -113,7 +113,7 @@ class User extends Model implements AuthenticatableContract, CanResetPasswordCon
      */
     public function socialAccounts()
     {
-        return $this->hasMany('BookStack\SocialAccount');
+        return $this->hasMany(SocialAccount::class);
     }
 
     /**
@@ -138,8 +138,8 @@ class User extends Model implements AuthenticatableContract, CanResetPasswordCon
      */
     public function getAvatar($size = 50)
     {
-        if ($this->image_id === 0 || $this->image_id === '0' || $this->image_id === null) return '/user_avatar.png';
-        return $this->avatar->getThumb($size, $size, false);
+        if ($this->image_id === 0 || $this->image_id === '0' || $this->image_id === null) return baseUrl('/user_avatar.png');
+        return baseUrl($this->avatar->getThumb($size, $size, false));
     }
 
     /**
@@ -148,7 +148,7 @@ class User extends Model implements AuthenticatableContract, CanResetPasswordCon
      */
     public function avatar()
     {
-        return $this->belongsTo('BookStack\Image', 'image_id');
+        return $this->belongsTo(Image::class, 'image_id');
     }
 
     /**
@@ -157,7 +157,16 @@ class User extends Model implements AuthenticatableContract, CanResetPasswordCon
      */
     public function getEditUrl()
     {
-        return '/settings/users/' . $this->id;
+        return baseUrl('/settings/users/' . $this->id);
+    }
+
+    /**
+     * Get the url that links to this user's profile.
+     * @return mixed
+     */
+    public function getProfileUrl()
+    {
+        return baseUrl('/user/' . $this->id);
     }
 
     /**