@@ -212,7 +212,7 @@ |
||
| 212 | 212 | |
| 213 | 213 | if ($this->gameMod !== null && is_array($this->gameMod->vars)) { |
| 214 | 214 | foreach ($this->gameMod->vars as $var) { |
| 215 | - if(!isset($var['var'])) { |
|
| 215 | + if (!isset($var['var'])) { |
|
| 216 | 216 | continue; |
| 217 | 217 | } |
| 218 | 218 | $varname = $var['var']; |
@@ -394,7 +394,7 @@ |
||
| 394 | 394 | if (Auth::user()->can(PermissionHelper::ADMIN_PERMISSIONS)) { |
| 395 | 395 | $extraMessage = $this->getDocMessage($exception); |
| 396 | 396 | } else { |
| 397 | - $extraMessage = (string)__('main.common_admin_error'); |
|
| 397 | + $extraMessage = (string) __('main.common_admin_error'); |
|
| 398 | 398 | } |
| 399 | 399 | |
| 400 | 400 | return $this->makeErrorResponse($exception->getMessage() . $extraMessage); |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | |
| 107 | 107 | public function getServersForUser(int $userId) |
| 108 | 108 | { |
| 109 | - $qb = QueryBuilder::for(Server::class) |
|
| 109 | + $qb = QueryBuilder::for (Server::class) |
|
| 110 | 110 | ->allowedFilters('ds_id') |
| 111 | 111 | ->allowedAppends('full_path') |
| 112 | 112 | ->with('game') |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | |
| 134 | 134 | public function getAllServers() |
| 135 | 135 | { |
| 136 | - $qb = QueryBuilder::for(Server::class) |
|
| 136 | + $qb = QueryBuilder::for (Server::class) |
|
| 137 | 137 | ->allowedFilters('ds_id') |
| 138 | 138 | ->allowedAppends('full_path') |
| 139 | 139 | ->with('game'); |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | |
| 174 | 174 | $query = DB::table($serversTable) |
| 175 | 175 | ->selectRaw("{$serversTable}.*, {$gamesTable}.name as game_name") |
| 176 | - ->whereIn('game_id', function ($query) use ($engines, $serversTable, $gamesTable): void { |
|
| 176 | + ->whereIn('game_id', function($query) use ($engines, $serversTable, $gamesTable): void { |
|
| 177 | 177 | $query->select('code') |
| 178 | 178 | ->from($gamesTable) |
| 179 | 179 | ->whereIn('engine', $engines); |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | public function search($query) |
| 200 | 200 | { |
| 201 | 201 | return $this->model->select(['id', 'name', 'server_ip', 'server_port', 'game_id', 'game_mod_id']) |
| 202 | - ->with(['game' => function ($query): void { |
|
| 202 | + ->with(['game' => function($query): void { |
|
| 203 | 203 | $query->select('code', 'name'); |
| 204 | 204 | }]) |
| 205 | 205 | ->where('name', 'LIKE', '%' . $query . '%') |
@@ -212,9 +212,9 @@ discard block |
||
| 212 | 212 | */ |
| 213 | 213 | public function update(Server $server, array $attributes): void |
| 214 | 214 | { |
| 215 | - $attributes['enabled'] = (bool)array_key_exists('enabled', $attributes); |
|
| 216 | - $attributes['blocked'] = (bool)array_key_exists('blocked', $attributes); |
|
| 217 | - $attributes['installed'] = (bool)array_key_exists('installed', $attributes); |
|
| 215 | + $attributes['enabled'] = (bool) array_key_exists('enabled', $attributes); |
|
| 216 | + $attributes['blocked'] = (bool) array_key_exists('blocked', $attributes); |
|
| 217 | + $attributes['installed'] = (bool) array_key_exists('installed', $attributes); |
|
| 218 | 218 | |
| 219 | 219 | if (isset($attributes['ds_id'])) { |
| 220 | 220 | $server->ds_id = $attributes['ds_id']; |
@@ -106,11 +106,12 @@ discard block |
||
| 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 | ->allowedAppends('full_path') |
| 112 | 112 | ->with('game') |
| 113 | 113 | ->whereRaw('id IN(SELECT server_id FROM server_user su WHERE su.user_id = ?)', [$userId]); |
| 114 | + } |
|
| 114 | 115 | |
| 115 | 116 | return $qb->get([ |
| 116 | 117 | 'id', |
@@ -133,10 +134,11 @@ discard block |
||
| 133 | 134 | |
| 134 | 135 | public function getAllServers() |
| 135 | 136 | { |
| 136 | - $qb = QueryBuilder::for(Server::class) |
|
| 137 | - ->allowedFilters('ds_id') |
|
| 137 | + $qb = QueryBuilder::for(Server::class) { |
|
| 138 | + ->allowedFilters('ds_id') |
|
| 138 | 139 | ->allowedAppends('full_path') |
| 139 | 140 | ->with('game'); |
| 141 | + } |
|
| 140 | 142 | |
| 141 | 143 | return $qb->get([ |
| 142 | 144 | 'id', |