@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | $query = Models\User::where('id', $id); |
| 84 | 84 | |
| 85 | 85 | if (!is_null($request->input('fields'))) { |
| 86 | - foreach(explode(',', $request->input('fields')) as $field) { |
|
| 86 | + foreach (explode(',', $request->input('fields')) as $field) { |
|
| 87 | 87 | if (!empty($field)) { |
| 88 | 88 | $query->addSelect($field); |
| 89 | 89 | } |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | |
| 98 | 98 | $user = $query->first(); |
| 99 | 99 | $userArray = $user->toArray(); |
| 100 | - $userArray['servers'] = Models\Server::select('id', 'uuid', 'node', 'suspended')->where('owner', $user->id)->get(); |
|
| 100 | + $userArray['servers'] = Models\Server::select('id', 'uuid', 'node', 'suspended')->where('owner', $user->id)->get(); |
|
| 101 | 101 | |
| 102 | 102 | return $userArray; |
| 103 | 103 | } catch (NotFoundHttpException $ex) { |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | try { |
| 130 | 130 | $user = new UserRepository; |
| 131 | 131 | $create = $user->create($request->input('email'), $request->input('password'), $request->input('admin'), $request->input('custom_id')); |
| 132 | - return [ 'id' => $create ]; |
|
| 132 | + return ['id' => $create]; |
|
| 133 | 133 | } catch (DisplayValidationException $ex) { |
| 134 | 134 | throw new ResourceException('A validation error occured.', json_decode($ex->getMessage(), true)); |
| 135 | 135 | } catch (DisplayException $ex) { |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | try { |
| 78 | 78 | $server = new ServerRepository; |
| 79 | 79 | $new = $server->create($request->all()); |
| 80 | - return [ 'id' => $new ]; |
|
| 80 | + return ['id' => $new]; |
|
| 81 | 81 | } catch (DisplayValidationException $ex) { |
| 82 | 82 | throw new ResourceException('A validation error occured.', json_decode($ex->getMessage(), true)); |
| 83 | 83 | } catch (DisplayException $ex) { |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | $query = Models\Server::where('id', $id); |
| 107 | 107 | |
| 108 | 108 | if (!is_null($request->input('fields'))) { |
| 109 | - foreach(explode(',', $request->input('fields')) as $field) { |
|
| 109 | + foreach (explode(',', $request->input('fields')) as $field) { |
|
| 110 | 110 | if (!empty($field)) { |
| 111 | 111 | $query->addSelect($field); |
| 112 | 112 | } |
@@ -298,7 +298,7 @@ discard block |
||
| 298 | 298 | return $this->response->noContent(); |
| 299 | 299 | } catch (DisplayException $ex) { |
| 300 | 300 | throw new ResourceException($ex->getMessage()); |
| 301 | - } catch(\Exception $e) { |
|
| 301 | + } catch (\Exception $e) { |
|
| 302 | 302 | throw new ServiceUnavailableHttpException('An error occured while attempting to delete this server.'); |
| 303 | 303 | } |
| 304 | 304 | } |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | try { |
| 103 | 103 | $node = new NodeRepository; |
| 104 | 104 | $new = $node->create($request->all()); |
| 105 | - return [ 'id' => $new ]; |
|
| 105 | + return ['id' => $new]; |
|
| 106 | 106 | } catch (DisplayValidationException $ex) { |
| 107 | 107 | throw new ResourceException('A validation error occured.', json_decode($ex->getMessage(), true)); |
| 108 | 108 | } catch (DisplayException $ex) { |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | $node = Models\Node::where('id', $id); |
| 131 | 131 | |
| 132 | 132 | if (!is_null($request->input('fields'))) { |
| 133 | - foreach(explode(',', $request->input('fields')) as $field) { |
|
| 133 | + foreach (explode(',', $request->input('fields')) as $field) { |
|
| 134 | 134 | if (!empty($field)) { |
| 135 | 135 | $node->addSelect($field); |
| 136 | 136 | } |
@@ -273,7 +273,7 @@ discard block |
||
| 273 | 273 | return $this->response->noContent(); |
| 274 | 274 | } catch (DisplayException $ex) { |
| 275 | 275 | throw new ResourceException($ex->getMessage()); |
| 276 | - } catch(\Exception $e) { |
|
| 276 | + } catch (\Exception $e) { |
|
| 277 | 277 | throw new ServiceUnavailableHttpException('An error occured while attempting to delete this node.'); |
| 278 | 278 | } |
| 279 | 279 | } |
@@ -54,7 +54,7 @@ |
||
| 54 | 54 | ->groupBy('locations.id') |
| 55 | 55 | ->get(); |
| 56 | 56 | |
| 57 | - foreach($locations as &$location) { |
|
| 57 | + foreach ($locations as &$location) { |
|
| 58 | 58 | $location->nodes = explode(',', $location->nodes); |
| 59 | 59 | } |
| 60 | 60 | |
@@ -61,7 +61,7 @@ |
||
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | $allocations = Models\Allocation::select('id', 'ip', 'port', 'ip_alias as alias')->where('assigned_to', $server->id)->get(); |
| 64 | - foreach($allocations as &$allocation) { |
|
| 64 | + foreach ($allocations as &$allocation) { |
|
| 65 | 65 | $allocation->default = ($allocation->id === $server->allocation); |
| 66 | 66 | unset($allocation->id); |
| 67 | 67 | } |
@@ -37,7 +37,7 @@ |
||
| 37 | 37 | $servers = Models\Server::getUserServers(); |
| 38 | 38 | $response = []; |
| 39 | 39 | |
| 40 | - foreach($servers as &$server) { |
|
| 40 | + foreach ($servers as &$server) { |
|
| 41 | 41 | $response = array_merge($response, [[ |
| 42 | 42 | 'id' => $server->uuidShort, |
| 43 | 43 | 'uuid' => $server->uuid, |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | $user = $request->user(); |
| 91 | - if($user->toggleTotp($request->input('token'))) { |
|
| 91 | + if ($user->toggleTotp($request->input('token'))) { |
|
| 92 | 92 | return response('true'); |
| 93 | 93 | } |
| 94 | 94 | |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | $user = $request->user(); |
| 114 | - if($user->toggleTotp($request->input('token'))) { |
|
| 114 | + if ($user->toggleTotp($request->input('token'))) { |
|
| 115 | 115 | return redirect()->route('account.security'); |
| 116 | 116 | } |
| 117 | 117 | |
@@ -41,7 +41,7 @@ |
||
| 41 | 41 | public function index(Request $request) |
| 42 | 42 | { |
| 43 | 43 | $keys = Models\APIKey::where('user', $request->user()->id)->get(); |
| 44 | - foreach($keys as &$key) { |
|
| 44 | + foreach ($keys as &$key) { |
|
| 45 | 45 | $key->permissions = Models\APIPermission::where('key_id', $key->id)->get(); |
| 46 | 46 | } |
| 47 | 47 | |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | |
| 188 | 188 | $download->save(); |
| 189 | 189 | |
| 190 | - return redirect( $node->scheme . '://' . $node->fqdn . ':' . $node->daemonListen . '/server/file/download/' . $download->token); |
|
| 190 | + return redirect($node->scheme . '://' . $node->fqdn . ':' . $node->daemonListen . '/server/file/download/' . $download->token); |
|
| 191 | 191 | |
| 192 | 192 | } |
| 193 | 193 | |
@@ -224,7 +224,7 @@ discard block |
||
| 224 | 224 | ]; |
| 225 | 225 | |
| 226 | 226 | $processed = str_replace(array_keys($serverVariables), array_values($serverVariables), $server->startup); |
| 227 | - foreach($variables as &$variable) { |
|
| 227 | + foreach ($variables as &$variable) { |
|
| 228 | 228 | $replace = ($variable->user_viewable === 1) ? $variable->a_serverValue : '**'; |
| 229 | 229 | $processed = str_replace('{{' . $variable->env_variable . '}}', $replace, $processed); |
| 230 | 230 | } |
@@ -275,7 +275,7 @@ discard block |
||
| 275 | 275 | Alert::success('Server startup variables were successfully updated.')->flash(); |
| 276 | 276 | } catch (DisplayException $ex) { |
| 277 | 277 | Alert::danger($ex->getMessage())->flash(); |
| 278 | - } catch(\Exception $ex) { |
|
| 278 | + } catch (\Exception $ex) { |
|
| 279 | 279 | Log::error($ex); |
| 280 | 280 | Alert::danger('An unhandled exception occured while attemping to update startup variables for this server. Please try again.')->flash(); |
| 281 | 281 | } |