Completed
Pull Request — master (#129)
by
unknown
04:37
created
app/Http/Controllers/UserController.php 1 patch
Braces   +10 added lines, -8 removed lines patch added patch discarded remove patch
@@ -127,19 +127,21 @@
 block discarded – undo
127 127
             $query->email = $request->input('email');
128 128
             $query->role = $request->input('role');
129 129
             $query->phone = $request->input('phone');
130
-            if ($request->input('password') != '')
131
-                $query->password = bcrypt($request->input('password'));
130
+            if ($request->input('password') != '') {
131
+                            $query->password = bcrypt($request->input('password'));
132
+            }
133
+        } else {
134
+                    $query->preferred_device_id = $request->input('preferred_device_id');
132 135
         }
133
-        else
134
-            $query->preferred_device_id = $request->input('preferred_device_id');
135 136
 
136 137
         $query->save();
137 138
     
138
-        if (\Request::ajax())
139
-            return response()->json([ 'success' => 'Preferred device updated successfully' ]);
140
-        else
141
-            return redirect()->route('user.show', $id)
139
+        if (\Request::ajax()) {
140
+                    return response()->json([ 'success' => 'Preferred device updated successfully' ]);
141
+        } else {
142
+                    return redirect()->route('user.show', $id)
142 143
                 ->with('success', 'User updated successfully');
144
+        }
143 145
     }
144 146
 
145 147
     /**
Please login to merge, or discard this patch.