]> BookStack Code Mirror - bookstack/blobdiff - app/Auth/UserRepo.php
Extend /users API endpoint
[bookstack] / app / Auth / UserRepo.php
index e437ff1e3b367daeba67fca740197a2e5483894f..4444c734c35077a557fcdfe8daf8664b082bfe3d 100644 (file)
@@ -61,6 +61,16 @@ class UserRepo
         return User::query()->with('roles', 'avatar')->orderBy('name', 'asc')->get();
     }
 
+    /**
+     * Get all users as Builder for API
+     */
+    public function getUsersBuilder(int $id = null ) : Builder
+    {
+        $query = User::query()->select(['*'])
+            ->withLastActivityAt()
+            ->with(['roles', 'avatar']);
+        return $query;
+    }
     /**
      * Get all the users with their permissions in a paginated format.
      */