| @@ -337,7 +337,7 @@ discard block | ||
| 337 | 337 | $collection = $this->repository->getServersForUser($currentUser->id); | 
| 338 | 338 | } | 
| 339 | 339 | |
| 340 | -        return $collection->map(function ($item) { | |
| 340 | +        return $collection->map(function($item) { | |
| 341 | 341 | return $item->only([ | 
| 342 | 342 | 'id', | 
| 343 | 343 | 'uuid', | 
| @@ -414,7 +414,7 @@ discard block | ||
| 414 | 414 |          if (Auth::user()->can(PermissionHelper::ADMIN_PERMISSIONS)) { | 
| 415 | 415 | $extraMessage = $this->getDocMessage($exception); | 
| 416 | 416 |          } else { | 
| 417 | -            $extraMessage = (string)__('main.common_admin_error'); | |
| 417 | +            $extraMessage = (string) __('main.common_admin_error'); | |
| 418 | 418 | } | 
| 419 | 419 | |
| 420 | 420 | 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 |              ->with('game:code,name,engine,engine_version') | 
| 112 | 112 |              ->whereRaw('id IN(SELECT server_id FROM server_user su WHERE su.user_id = ?)', [$userId]); | 
| @@ -116,7 +116,7 @@ discard block | ||
| 116 | 116 | |
| 117 | 117 | public function getAllServers() | 
| 118 | 118 |      { | 
| 119 | - $qb = QueryBuilder::for(Server::class) | |
| 119 | + $qb = QueryBuilder::for (Server::class) | |
| 120 | 120 |              ->allowedFilters('ds_id') | 
| 121 | 121 | ->allowedAppends(['full_path']) | 
| 122 | 122 |              ->with('game:code,name,engine,engine_version'); | 
| @@ -140,7 +140,7 @@ discard block | ||
| 140 | 140 | |
| 141 | 141 | $query = DB::table($serversTable) | 
| 142 | 142 |              ->selectRaw("{$serversTable}.*, {$gamesTable}.name as game_name") | 
| 143 | -            ->whereIn('game_id', function ($query) use ($engines, $serversTable, $gamesTable): void { | |
| 143 | +            ->whereIn('game_id', function($query) use ($engines, $serversTable, $gamesTable): void { | |
| 144 | 144 |                  $query->select('code') | 
| 145 | 145 | ->from($gamesTable) | 
| 146 | 146 |                      ->whereIn('engine', $engines); | 
| @@ -166,7 +166,7 @@ discard block | ||
| 166 | 166 | public function search($query) | 
| 167 | 167 |      { | 
| 168 | 168 | return $this->model->select(['id', 'name', 'server_ip', 'server_port', 'game_id', 'game_mod_id']) | 
| 169 | -            ->with(['game' => function ($query): void { | |
| 169 | +            ->with(['game' => function($query): void { | |
| 170 | 170 |                  $query->select('code', 'name'); | 
| 171 | 171 | }]) | 
| 172 | 172 |              ->where('name', 'LIKE', '%' . $query . '%') | 
| @@ -179,9 +179,9 @@ discard block | ||
| 179 | 179 | */ | 
| 180 | 180 | public function update(Server $server, array $attributes): void | 
| 181 | 181 |      { | 
| 182 | -        $attributes['enabled']   = (bool)array_key_exists('enabled', $attributes); | |
| 183 | -        $attributes['blocked']   = (bool)array_key_exists('blocked', $attributes); | |
| 184 | -        $attributes['installed'] = (bool)array_key_exists('installed', $attributes); | |
| 182 | +        $attributes['enabled']   = (bool) array_key_exists('enabled', $attributes); | |
| 183 | +        $attributes['blocked']   = (bool) array_key_exists('blocked', $attributes); | |
| 184 | +        $attributes['installed'] = (bool) array_key_exists('installed', $attributes); | |
| 185 | 185 | |
| 186 | 186 |          if (isset($attributes['ds_id'])) { | 
| 187 | 187 | $server->ds_id = $attributes['ds_id']; | 
| @@ -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 | } |