@@ -211,11 +211,12 @@ public function getDaemonServiceData(Server $server, bool $refresh = false): arr
211211 *
212212 * @param \Pterodactyl\Models\User $user
213213 * @param int $level
214- * @return \Illuminate\Pagination\LengthAwarePaginator
214+ * @param bool $paginate
215+ * @return \Illuminate\Contracts\Pagination\LengthAwarePaginator|\Illuminate\Database\Eloquent\Collection
215216 */
216- public function filterUserAccessServers (User $ user , int $ level): LengthAwarePaginator
217+ public function filterUserAccessServers (User $ user , int $ level, bool $ paginate = true )
217218 {
218- $ instance = $ this ->getBuilder ()->with (['user ' ]);
219+ $ instance = $ this ->getBuilder ()->select ( $ this -> getColumns ())-> with (['user ' ]);
219220
220221 // If access level is set to owner, only display servers
221222 // that the user owns.
@@ -224,8 +225,9 @@ public function filterUserAccessServers(User $user, int $level): LengthAwarePagi
224225 }
225226
226227 // If set to all, display all servers they can access, including
227- // those they access as an admin. If set to subuser, only return the servers they can access because
228- // they are owner, or marked as a subuser of the server.
228+ // those they access as an admin. If set to subuser, only return
229+ // the servers they can access because they are owner, or marked
230+ // as a subuser of the server.
229231 elseif (($ level === User::FILTER_LEVEL_ALL && ! $ user ->root_admin ) || $ level === User::FILTER_LEVEL_SUBUSER ) {
230232 $ instance ->whereIn ('id ' , $ this ->getUserAccessServers ($ user ->id ));
231233 }
@@ -236,7 +238,9 @@ public function filterUserAccessServers(User $user, int $level): LengthAwarePagi
236238 $ instance ->whereNotIn ('id ' , $ this ->getUserAccessServers ($ user ->id ));
237239 }
238240
239- return $ instance ->search ($ this ->getSearchTerm ())->paginate (25 );
241+ $ instance ->search ($ this ->getSearchTerm ());
242+
243+ return $ paginate ? $ instance ->paginate (25 ) : $ instance ->get ();
240244 }
241245
242246 /**
0 commit comments