Completed
Push — widgets-pivot ( dc1e33 )
by Tony
02:59
created
app/Api/Controllers/DashboardController.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@
 block discarded – undo
59 59
 
60 60
             if ($dashboard) {
61 61
                 if (is_numeric($request->copy_from)) {
62
-                    Dashboard::find($request->copy_from)->widgets->each(function (UsersWidgets $widget) use ($dashboard) {
62
+                    Dashboard::find($request->copy_from)->widgets->each(function(UsersWidgets $widget) use ($dashboard) {
63 63
                         $dashboard->widgets()->save($widget->replicate());
64 64
                     });
65 65
 
Please login to merge, or discard this patch.
Braces   +14 added lines, -7 removed lines patch added patch discarded remove patch
@@ -65,10 +65,12 @@  discard block
 block discarded – undo
65 65
 
66 66
                 }
67 67
                 return $this->response->array(array('statusText' => 'OK', 'dashboard_id' => $dashboard->dashboard_id));
68
-            } else {
68
+            }
69
+            else {
69 70
                 return $this->response->errorInternal();
70 71
             }
71
-        } else {
72
+        }
73
+        else {
72 74
             $errors = $validation->errors();
73 75
             return response()->json($errors, 422);
74 76
         }
@@ -119,10 +121,12 @@  discard block
 block discarded – undo
119 121
             $dashboard->access         = $request->access;
120 122
             if ($dashboard->save()) {
121 123
                 return $this->response->array(array('statusText' => 'OK'));
122
-            } else {
124
+            }
125
+            else {
123 126
                 return $this->response->errorInternal();
124 127
             }
125
-        } else {
128
+        }
129
+        else {
126 130
             $errors = $validation->errors();
127 131
             return response()->json($errors, 422);
128 132
         }
@@ -140,10 +144,12 @@  discard block
 block discarded – undo
140 144
         if ($request->user()->dashboards()->where('dashboard_id', $id)->delete()) {
141 145
             if (UsersWidgets::where('dashboard_id', $id)->delete() >= 0) {
142 146
                 return $this->response->array(array('statusText' => 'OK'));
143
-            } else {
147
+            }
148
+            else {
144 149
                 return $this->response->errorInternal();
145 150
             }
146
-        } else {
151
+        }
152
+        else {
147 153
             return $this->response->errorInternal();
148 154
         }
149 155
     }
@@ -152,7 +158,8 @@  discard block
 block discarded – undo
152 158
     {
153 159
         if (Dashboard::find($id)->widgets()->delete() >= 0) {
154 160
             return $this->response->array(array('statusText' => 'OK'));
155
-        } else {
161
+        }
162
+        else {
156 163
             return $this->response->errorInternal();
157 164
         }
158 165
     }
Please login to merge, or discard this patch.
app/Api/Controllers/WidgetController.php 1 patch
Braces   +8 added lines, -4 removed lines patch added patch discarded remove patch
@@ -54,7 +54,8 @@  discard block
 block discarded – undo
54 54
 
55 55
         if ($dashboard->widgets()->save($user_widget)) {
56 56
             return $this->response->array(array('statusText' => 'OK', 'user_widget_id' => $user_widget->user_widget_id));
57
-        } else {
57
+        }
58
+        else {
58 59
             return $this->response->errorInternal();
59 60
         }
60 61
     }
@@ -94,7 +95,8 @@  discard block
 block discarded – undo
94 95
         if ($request->input('settings')) {
95 96
             $users_widgets = UsersWidgets::find($id);
96 97
             $users_widgets->settings = $request->input('settings');
97
-        } else {
98
+        }
99
+        else {
98 100
             $users_widgets = UsersWidgets::find($id);
99 101
             $users_widgets->col = $request->input('x');
100 102
             $users_widgets->row = $request->input('y');
@@ -104,7 +106,8 @@  discard block
 block discarded – undo
104 106
 
105 107
         if ($users_widgets->save()) {
106 108
             return $this->response->array(array('statusText' => 'OK'));
107
-        } else {
109
+        }
110
+        else {
108 111
             return $this->response->errorInternal();
109 112
         }
110 113
     }
@@ -119,7 +122,8 @@  discard block
 block discarded – undo
119 122
     {
120 123
         if (UsersWidgets::destroy($id)) {
121 124
             return $this->response->array(array('statusText' => 'OK'));
122
-        } else {
125
+        }
126
+        else {
123 127
             return $this->response->errorInternal();
124 128
         }
125 129
     }
Please login to merge, or discard this patch.
app/Models/Dashboard.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@
 block discarded – undo
55 55
     {
56 56
         parent::boot();
57 57
 
58
-        static::deleting(function (Dashboard $dashboard) {
58
+        static::deleting(function(Dashboard $dashboard) {
59 59
             // delete related data
60 60
             $dashboard->widgets()->delete();
61 61
         });
Please login to merge, or discard this patch.