Passed
Pull Request — develop (#94)
by Nikita
04:51
created
app/Repositories/ServerRepository.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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'];
Please login to merge, or discard this patch.
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -106,11 +106,12 @@  discard block
 block discarded – undo
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
 block discarded – undo
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',
Please login to merge, or discard this patch.