@@ -106,20 +106,22 @@ |
||
| 106 | 106 | |
| 107 | 107 | public function getServersForUser(int $userId) |
| 108 | 108 | { |
| 109 | - $qb = QueryBuilder::for(Server::class) |
|
| 110 | - ->allowedFilters('ds_id') |
|
| 109 | + $qb = QueryBuilder::for(Server::class) { |
|
| 110 | + ->allowedFilters('ds_id') |
|
| 111 | 111 | ->with('game:code,name,engine,engine_version') |
| 112 | 112 | ->whereRaw('id IN(SELECT server_id FROM server_user su WHERE su.user_id = ?)', [$userId]); |
| 113 | + } |
|
| 113 | 114 | |
| 114 | 115 | return $qb->get()->append(['online']); |
| 115 | 116 | } |
| 116 | 117 | |
| 117 | 118 | public function getAllServers() |
| 118 | 119 | { |
| 119 | - $qb = QueryBuilder::for(Server::class) |
|
| 120 | - ->allowedFilters('ds_id') |
|
| 120 | + $qb = QueryBuilder::for(Server::class) { |
|
| 121 | + ->allowedFilters('ds_id') |
|
| 121 | 122 | ->allowedAppends(['full_path']) |
| 122 | 123 | ->with('game:code,name,engine,engine_version'); |
| 124 | + } |
|
| 123 | 125 | |
| 124 | 126 | return $qb->get()->append(['online']); |
| 125 | 127 | } |