X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/da37700ac23b0a3789c7da1ed3517d1900d5894d..refs/pull/2902/head:/app/Auth/Role.php diff --git a/app/Auth/Role.php b/app/Auth/Role.php index 255158afb..dcd960948 100644 --- a/app/Auth/Role.php +++ b/app/Auth/Role.php @@ -1,29 +1,33 @@ -belongsToMany(User::class)->orderBy('name', 'asc'); } @@ -39,7 +43,7 @@ class Role extends Model implements Loggable /** * The RolePermissions that belong to the role. */ - public function permissions() + public function permissions(): BelongsToMany { return $this->belongsToMany(RolePermission::class, 'permission_role', 'role_id', 'permission_id'); } @@ -55,6 +59,7 @@ class Role extends Model implements Loggable return true; } } + return false; } @@ -91,7 +96,7 @@ class Role extends Model implements Loggable } /** - * Get all visible roles + * Get all visible roles. */ public static function visible(): Collection { @@ -103,7 +108,10 @@ class Role extends Model implements Loggable */ public static function restrictable(): Collection { - return static::query()->where('system_name', '!=', 'admin')->get(); + return static::query() + ->where('system_name', '!=', 'admin') + ->orderBy('display_name', 'asc') + ->get(); } /**