]> BookStack Code Mirror - bookstack/blobdiff - app/Repos/UserRepo.php
Finished migration of last angular code
[bookstack] / app / Repos / UserRepo.php
index 127db9fb59c482aab05198277558bf7b6abdcac6..c3546a442cc27dc8fecfc54d04ec66f0b16ceac9 100644 (file)
@@ -3,7 +3,6 @@
 use BookStack\Role;
 use BookStack\User;
 use Exception;
-use Setting;
 
 class UserRepo
 {
@@ -169,13 +168,13 @@ class UserRepo
     public function getRecentlyCreated(User $user, $count = 20)
     {
         return [
-            'pages'    => $this->entityRepo->getRecentlyCreatedPages($count, 0, function ($query) use ($user) {
+            'pages'    => $this->entityRepo->getRecentlyCreated('page', $count, 0, function ($query) use ($user) {
                 $query->where('created_by', '=', $user->id);
             }),
-            'chapters' => $this->entityRepo->getRecentlyCreatedChapters($count, 0, function ($query) use ($user) {
+            'chapters' => $this->entityRepo->getRecentlyCreated('chapter', $count, 0, function ($query) use ($user) {
                 $query->where('created_by', '=', $user->id);
             }),
-            'books'    => $this->entityRepo->getRecentlyCreatedBooks($count, 0, function ($query) use ($user) {
+            'books'    => $this->entityRepo->getRecentlyCreated('book', $count, 0, function ($query) use ($user) {
                 $query->where('created_by', '=', $user->id);
             })
         ];
@@ -199,9 +198,9 @@ class UserRepo
      * Get the roles in the system that are assignable to a user.
      * @return mixed
      */
-    public function getAssignableRoles()
+    public function getAllRoles()
     {
-        return $this->role->visible();
+        return $this->role->all();
     }
 
     /**
@@ -211,7 +210,7 @@ class UserRepo
      */
     public function getRestrictableRoles()
     {
-        return $this->role->where('hidden', '=', false)->where('system_name', '=', '')->get();
+        return $this->role->where('system_name', '!=', 'admin')->get();
     }
 
 }
\ No newline at end of file