Passed
Push — master ( 06bf02...b3147e )
by Ferry
03:01
created
src/helpers/ModuleGenerator.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -40,12 +40,12 @@  discard block
 block discarded – undo
40 40
     }
41 41
 
42 42
     public function make() {
43
-        $name = ($this->name)?:ucwords(str_replace("_"," ",$this->table));
43
+        $name = ($this->name) ?: ucwords(str_replace("_", " ", $this->table));
44 44
 
45 45
         $template = file_get_contents(__DIR__."/../templates/FooBarController.stub");
46 46
 
47 47
         //Replace table
48
-        $template = str_replace("{table}",'"'.$this->table.'"', $template);
48
+        $template = str_replace("{table}", '"'.$this->table.'"', $template);
49 49
 
50 50
         //Replace permalink
51 51
         $template = str_replace("{permalink}", '"'.$this->table.'"', $template);
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
         //Replace scaffolding
57 57
         $fields = DB::getSchemaBuilder()->getColumnListing($this->table);
58 58
         $scaffold = "";
59
-        foreach($fields as $field) {
59
+        foreach ($fields as $field) {
60 60
             $scaffold .= '$this->addText("'.$field.'");'."\n\t\t";
61 61
         }
62 62
         $template = str_replace("{scaffolding}", $scaffold, $template);
Please login to merge, or discard this patch.
src/controllers/CBController.php 2 patches
Spacing   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -26,14 +26,14 @@  discard block
 block discarded – undo
26 26
 
27 27
     public function __call($method, $parameters)
28 28
     {
29
-        if($method == "getData") {
29
+        if ($method == "getData") {
30 30
             $key = $parameters[0];
31
-            if(isset($this->data[$key])) {
31
+            if (isset($this->data[$key])) {
32 32
                 return $this->data[$key];
33
-            }else{
33
+            } else {
34 34
                 return null;
35 35
             }
36
-        }else{
36
+        } else {
37 37
             return null;
38 38
         }
39 39
     }
@@ -48,19 +48,19 @@  discard block
 block discarded – undo
48 48
 
49 49
         $query->addSelect($this->data['table'].'.'.cb()->pk($this->data['table']).' as primary_key');
50 50
 
51
-        if(isset($this->data['hook_query_index']) && is_callable($this->data['hook_query_index']))
51
+        if (isset($this->data['hook_query_index']) && is_callable($this->data['hook_query_index']))
52 52
         {
53 53
             $query = call_user_func($this->data['hook_query_index'], $query);
54 54
         }
55 55
 
56
-        $softDelete = isset($this->data['disable_soft_delete'])?$this->data['disable_soft_delete']:true;
57
-        if($softDelete === true && Schema::hasColumn($this->data['table'],'deleted_at')) {
56
+        $softDelete = isset($this->data['disable_soft_delete']) ? $this->data['disable_soft_delete'] : true;
57
+        if ($softDelete === true && Schema::hasColumn($this->data['table'], 'deleted_at')) {
58 58
             $query->whereNull($this->data['table'].'.deleted_at');
59 59
         }
60 60
 
61 61
 
62
-        if(isset($joins)) {
63
-            foreach($joins as $join)
62
+        if (isset($joins)) {
63
+            foreach ($joins as $join)
64 64
             {
65 65
                 $query->join($join['target_table'],
66 66
                         $join['target_table_primary'],
@@ -70,31 +70,31 @@  discard block
 block discarded – undo
70 70
             }
71 71
         }
72 72
 
73
-        foreach($columns as $column) {
73
+        foreach ($columns as $column) {
74 74
             /** @var ColumnModel $column */
75
-            if(strpos($column->getField(),".") === false) {
75
+            if (strpos($column->getField(), ".") === false) {
76 76
                 $query->addSelect($this->data['table'].'.'.$column->getField());
77
-            }else{
77
+            } else {
78 78
                 $query->addSelect($column->getField());
79 79
             }
80 80
 
81 81
             $query = getTypeHook($column->getType())->query($query, $column);
82 82
         }
83 83
 
84
-        if(request()->has('q'))
84
+        if (request()->has('q'))
85 85
         {
86
-            if(isset($this->data['hook_search_query'])) {
86
+            if (isset($this->data['hook_search_query'])) {
87 87
                 $query = call_user_func($this->data['hook_search_query'], $query);
88
-            }else{
89
-                $query->where(function ($where) use ($columns) {
88
+            } else {
89
+                $query->where(function($where) use ($columns) {
90 90
                     /**
91 91
                      * @var $where Builder
92 92
                      */
93
-                    foreach($columns as $column)
93
+                    foreach ($columns as $column)
94 94
                     {
95
-                        if(strpos($column->getField(),".") === false) {
95
+                        if (strpos($column->getField(), ".") === false) {
96 96
                             $field = $this->data['table'].'.'.$column->getField();
97
-                        }else{
97
+                        } else {
98 98
                             $field = $column->getField();
99 99
                         }
100 100
                         $where->orWhere($field, 'like', '%'.request('q').'%');
@@ -103,17 +103,17 @@  discard block
 block discarded – undo
103 103
             }
104 104
         }
105 105
 
106
-        if(isset($this->data['hook_query_index']) && is_callable($this->data['hook_query_index'])) {
106
+        if (isset($this->data['hook_query_index']) && is_callable($this->data['hook_query_index'])) {
107 107
             $query = call_user_func($this->data['hook_query_index'], $query);
108 108
         }
109 109
 
110 110
 
111
-        if(request()->has(['order_by','order_sort']))
111
+        if (request()->has(['order_by', 'order_sort']))
112 112
         {
113
-            if(in_array(request('order_by'),columnSingleton()->getColumnNameOnly())) {
113
+            if (in_array(request('order_by'), columnSingleton()->getColumnNameOnly())) {
114 114
                 $query->orderBy(request('order_by'), request('order_sort'));
115 115
             }
116
-        }else{
116
+        } else {
117 117
             $query->orderBy($this->data['table'].'.'.cb()->findPrimaryKey($this->data['table']), "desc");
118 118
         }
119 119
 
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 
123 123
     public function getIndex()
124 124
     {
125
-        if(!module()->canBrowse()) return cb()->redirect(cb()->getAdminUrl(),"You do not have a privilege access to this area");
125
+        if (!module()->canBrowse()) return cb()->redirect(cb()->getAdminUrl(), "You do not have a privilege access to this area");
126 126
 
127 127
         $query = $this->repository();
128 128
         $result = $query->paginate(20);
@@ -137,29 +137,29 @@  discard block
 block discarded – undo
137 137
      */
138 138
     private function validation()
139 139
     {
140
-        if(isset($this->data['validation'])) {
140
+        if (isset($this->data['validation'])) {
141 141
             $validator = Validator::make(request()->all(), @$this->data['validation'], @$this->data['validation_messages']);
142 142
             if ($validator->fails()) {
143 143
                 $message = $validator->messages();
144 144
                 $message_all = $message->all();
145
-                throw new CBValidationException(implode(', ',$message_all));
145
+                throw new CBValidationException(implode(', ', $message_all));
146 146
             }
147 147
         }
148 148
     }
149 149
 
150 150
     public function getAdd()
151 151
     {
152
-        if(!module()->canCreate()) return cb()->redirect(cb()->getAdminUrl(),"You do not have a privilege access to this area");
152
+        if (!module()->canCreate()) return cb()->redirect(cb()->getAdminUrl(), "You do not have a privilege access to this area");
153 153
 
154 154
         $data = [];
155 155
         $data['page_title'] = $this->data['page_title'].' : Add';
156 156
         $data['action_url'] = module()->addSaveURL();
157
-        return view('crudbooster::module.form.form',array_merge($data, $this->data));
157
+        return view('crudbooster::module.form.form', array_merge($data, $this->data));
158 158
     }
159 159
 
160 160
     public function postAddSave()
161 161
     {
162
-        if(!module()->canCreate()) return cb()->redirect(cb()->getAdminUrl(),"You do not have a privilege access to this area");
162
+        if (!module()->canCreate()) return cb()->redirect(cb()->getAdminUrl(), "You do not have a privilege access to this area");
163 163
 
164 164
         try {
165 165
             $this->validation();
@@ -167,24 +167,24 @@  discard block
 block discarded – undo
167 167
             $data = columnSingleton()->getAssignmentData();
168 168
 
169 169
             //Clear data from Primary Key
170
-            unset($data[ cb()->pk($this->data['table']) ]);
170
+            unset($data[cb()->pk($this->data['table'])]);
171 171
 
172
-            if(Schema::hasColumn($this->data['table'], 'created_at')) {
172
+            if (Schema::hasColumn($this->data['table'], 'created_at')) {
173 173
                 $data['created_at'] = date('Y-m-d H:i:s');
174 174
             }
175 175
 
176 176
             $id = DB::table($this->data['table'])->insertGetId($data);
177 177
 
178
-            if(isset($this->data['hook_after_insert']) && is_callable($this->data['hook_after_insert'])) {
178
+            if (isset($this->data['hook_after_insert']) && is_callable($this->data['hook_after_insert'])) {
179 179
                 call_user_func($this->data['hook_after_insert'], $id);
180 180
             }
181 181
 
182 182
         } catch (CBValidationException $e) {
183 183
             Log::debug($e);
184
-            return cb()->redirectBack($e->getMessage(),'info');
184
+            return cb()->redirectBack($e->getMessage(), 'info');
185 185
         } catch (\Exception $e) {
186 186
             Log::error($e);
187
-            return cb()->redirectBack($e->getMessage(),'warning');
187
+            return cb()->redirectBack($e->getMessage(), 'warning');
188 188
         }
189 189
 
190 190
         if (request('submit') == trans('crudbooster.button_save_more')) {
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
 
197 197
     public function getEdit($id)
198 198
     {
199
-        if(!module()->canUpdate()) return cb()->redirect(cb()->getAdminUrl(),"You do not have a privilege access to this area");
199
+        if (!module()->canUpdate()) return cb()->redirect(cb()->getAdminUrl(), "You do not have a privilege access to this area");
200 200
 
201 201
         $data = [];
202 202
         $data['row'] = $this->repository()->where($this->data['table'].'.'.getPrimaryKey($this->data['table']), $id)->first();
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
 
208 208
     public function postEditSave($id)
209 209
     {
210
-        if(!module()->canUpdate()) return cb()->redirect(cb()->getAdminUrl(),"You do not have a privilege access to this area");
210
+        if (!module()->canUpdate()) return cb()->redirect(cb()->getAdminUrl(), "You do not have a privilege access to this area");
211 211
 
212 212
         try {
213 213
             $this->validation();
@@ -215,13 +215,13 @@  discard block
 block discarded – undo
215 215
             $data = columnSingleton()->getAssignmentData();
216 216
 
217 217
             //Clear data from Primary Key
218
-            unset($data[ cb()->pk($this->data['table']) ]);
218
+            unset($data[cb()->pk($this->data['table'])]);
219 219
 
220
-            if(Schema::hasColumn($this->data['table'], 'updated_at')) {
220
+            if (Schema::hasColumn($this->data['table'], 'updated_at')) {
221 221
                 $data['updated_at'] = date('Y-m-d H:i:s');
222 222
             }
223 223
 
224
-            if(isset($this->data['hook_before_update']) && is_callable($this->data['hook_before_update'])) {
224
+            if (isset($this->data['hook_before_update']) && is_callable($this->data['hook_before_update'])) {
225 225
                 call_user_func($this->data['hook_before_update'], $id);
226 226
             }
227 227
 
@@ -229,16 +229,16 @@  discard block
 block discarded – undo
229 229
                 ->where(cb()->pk($this->data['table']), $id)
230 230
                 ->update($data);
231 231
 
232
-            if(isset($this->data['hook_after_update']) && is_callable($this->data['hook_after_update'])) {
232
+            if (isset($this->data['hook_after_update']) && is_callable($this->data['hook_after_update'])) {
233 233
                 call_user_func($this->data['hook_after_update'], $id);
234 234
             }
235 235
 
236 236
         } catch (CBValidationException $e) {
237 237
             Log::debug($e);
238
-            return cb()->redirectBack($e->getMessage(),'info');
238
+            return cb()->redirectBack($e->getMessage(), 'info');
239 239
         } catch (\Exception $e) {
240 240
             Log::error($e);
241
-            return cb()->redirectBack($e->getMessage(),'warning');
241
+            return cb()->redirectBack($e->getMessage(), 'warning');
242 242
         }
243 243
 
244 244
 
@@ -251,15 +251,15 @@  discard block
 block discarded – undo
251 251
 
252 252
     public function getDelete($id)
253 253
     {
254
-        if(!module()->canDelete()) return cb()->redirect(cb()->getAdminUrl(),"You do not have a privilege access to this area");
254
+        if (!module()->canDelete()) return cb()->redirect(cb()->getAdminUrl(), "You do not have a privilege access to this area");
255 255
 
256
-        if(isset($this->data['hook_before_delete']) && is_callable($this->data['hook_before_delete'])) {
256
+        if (isset($this->data['hook_before_delete']) && is_callable($this->data['hook_before_delete'])) {
257 257
             call_user_func($this->data['hook_before_delete'], $id);
258 258
         }
259 259
 
260
-        $softDelete = isset($this->data['disable_soft_delete'])?$this->data['disable_soft_delete']:true;
260
+        $softDelete = isset($this->data['disable_soft_delete']) ? $this->data['disable_soft_delete'] : true;
261 261
 
262
-        if ($softDelete === true && Schema::hasColumn($this->data['table'],'deleted_at')) {
262
+        if ($softDelete === true && Schema::hasColumn($this->data['table'], 'deleted_at')) {
263 263
             DB::table($this->data['table'])
264 264
                 ->where(getPrimaryKey($this->data['table']), $id)
265 265
                 ->update(['deleted_at' => date('Y-m-d H:i:s')]);
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
                 ->delete();
270 270
         }
271 271
 
272
-        if(isset($this->data['hook_after_delete']) && is_callable($this->data['hook_after_delete'])) {
272
+        if (isset($this->data['hook_after_delete']) && is_callable($this->data['hook_after_delete'])) {
273 273
             call_user_func($this->data['hook_after_delete'], $id);
274 274
         }
275 275
 
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
 
279 279
     public function getDetail($id)
280 280
     {
281
-        if(!module()->canRead()) return cb()->redirect(cb()->getAdminUrl(),"You do not have a privilege access to this area");
281
+        if (!module()->canRead()) return cb()->redirect(cb()->getAdminUrl(), "You do not have a privilege access to this area");
282 282
 
283 283
         $data = [];
284 284
         $data['row'] = $this->repository()->where($this->data['table'].'.'.getPrimaryKey($this->data['table']), $id)->first();
Please login to merge, or discard this patch.
Braces   +27 added lines, -13 removed lines patch added patch discarded remove patch
@@ -30,10 +30,10 @@  discard block
 block discarded – undo
30 30
             $key = $parameters[0];
31 31
             if(isset($this->data[$key])) {
32 32
                 return $this->data[$key];
33
-            }else{
33
+            } else{
34 34
                 return null;
35 35
             }
36
-        }else{
36
+        } else{
37 37
             return null;
38 38
         }
39 39
     }
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
             /** @var ColumnModel $column */
75 75
             if(strpos($column->getField(),".") === false) {
76 76
                 $query->addSelect($this->data['table'].'.'.$column->getField());
77
-            }else{
77
+            } else{
78 78
                 $query->addSelect($column->getField());
79 79
             }
80 80
 
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
         {
86 86
             if(isset($this->data['hook_search_query'])) {
87 87
                 $query = call_user_func($this->data['hook_search_query'], $query);
88
-            }else{
88
+            } else{
89 89
                 $query->where(function ($where) use ($columns) {
90 90
                     /**
91 91
                      * @var $where Builder
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
                     {
95 95
                         if(strpos($column->getField(),".") === false) {
96 96
                             $field = $this->data['table'].'.'.$column->getField();
97
-                        }else{
97
+                        } else{
98 98
                             $field = $column->getField();
99 99
                         }
100 100
                         $where->orWhere($field, 'like', '%'.request('q').'%');
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
             if(in_array(request('order_by'),columnSingleton()->getColumnNameOnly())) {
114 114
                 $query->orderBy(request('order_by'), request('order_sort'));
115 115
             }
116
-        }else{
116
+        } else{
117 117
             $query->orderBy($this->data['table'].'.'.cb()->findPrimaryKey($this->data['table']), "desc");
118 118
         }
119 119
 
@@ -122,7 +122,9 @@  discard block
 block discarded – undo
122 122
 
123 123
     public function getIndex()
124 124
     {
125
-        if(!module()->canBrowse()) return cb()->redirect(cb()->getAdminUrl(),"You do not have a privilege access to this area");
125
+        if(!module()->canBrowse()) {
126
+            return cb()->redirect(cb()->getAdminUrl(),"You do not have a privilege access to this area");
127
+        }
126 128
 
127 129
         $query = $this->repository();
128 130
         $result = $query->paginate(20);
@@ -149,7 +151,9 @@  discard block
 block discarded – undo
149 151
 
150 152
     public function getAdd()
151 153
     {
152
-        if(!module()->canCreate()) return cb()->redirect(cb()->getAdminUrl(),"You do not have a privilege access to this area");
154
+        if(!module()->canCreate()) {
155
+            return cb()->redirect(cb()->getAdminUrl(),"You do not have a privilege access to this area");
156
+        }
153 157
 
154 158
         $data = [];
155 159
         $data['page_title'] = $this->data['page_title'].' : Add';
@@ -159,7 +163,9 @@  discard block
 block discarded – undo
159 163
 
160 164
     public function postAddSave()
161 165
     {
162
-        if(!module()->canCreate()) return cb()->redirect(cb()->getAdminUrl(),"You do not have a privilege access to this area");
166
+        if(!module()->canCreate()) {
167
+            return cb()->redirect(cb()->getAdminUrl(),"You do not have a privilege access to this area");
168
+        }
163 169
 
164 170
         try {
165 171
             $this->validation();
@@ -196,7 +202,9 @@  discard block
 block discarded – undo
196 202
 
197 203
     public function getEdit($id)
198 204
     {
199
-        if(!module()->canUpdate()) return cb()->redirect(cb()->getAdminUrl(),"You do not have a privilege access to this area");
205
+        if(!module()->canUpdate()) {
206
+            return cb()->redirect(cb()->getAdminUrl(),"You do not have a privilege access to this area");
207
+        }
200 208
 
201 209
         $data = [];
202 210
         $data['row'] = $this->repository()->where($this->data['table'].'.'.getPrimaryKey($this->data['table']), $id)->first();
@@ -207,7 +215,9 @@  discard block
 block discarded – undo
207 215
 
208 216
     public function postEditSave($id)
209 217
     {
210
-        if(!module()->canUpdate()) return cb()->redirect(cb()->getAdminUrl(),"You do not have a privilege access to this area");
218
+        if(!module()->canUpdate()) {
219
+            return cb()->redirect(cb()->getAdminUrl(),"You do not have a privilege access to this area");
220
+        }
211 221
 
212 222
         try {
213 223
             $this->validation();
@@ -251,7 +261,9 @@  discard block
 block discarded – undo
251 261
 
252 262
     public function getDelete($id)
253 263
     {
254
-        if(!module()->canDelete()) return cb()->redirect(cb()->getAdminUrl(),"You do not have a privilege access to this area");
264
+        if(!module()->canDelete()) {
265
+            return cb()->redirect(cb()->getAdminUrl(),"You do not have a privilege access to this area");
266
+        }
255 267
 
256 268
         if(isset($this->data['hook_before_delete']) && is_callable($this->data['hook_before_delete'])) {
257 269
             call_user_func($this->data['hook_before_delete'], $id);
@@ -278,7 +290,9 @@  discard block
 block discarded – undo
278 290
 
279 291
     public function getDetail($id)
280 292
     {
281
-        if(!module()->canRead()) return cb()->redirect(cb()->getAdminUrl(),"You do not have a privilege access to this area");
293
+        if(!module()->canRead()) {
294
+            return cb()->redirect(cb()->getAdminUrl(),"You do not have a privilege access to this area");
295
+        }
282 296
 
283 297
         $data = [];
284 298
         $data['row'] = $this->repository()->where($this->data['table'].'.'.getPrimaryKey($this->data['table']), $id)->first();
Please login to merge, or discard this patch.
src/controllers/scaffolding/singletons/ColumnSingleton.php 2 patches
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -42,17 +42,17 @@  discard block
 block discarded – undo
42 42
     public function valueAssignment($data_row = null) {
43 43
         foreach ($this->getColumns() as $index=>$column) {
44 44
 
45
-            if (! $column->getName()) {
45
+            if (!$column->getName()) {
46 46
                 continue;
47 47
             }
48 48
 
49 49
             /** @var ColumnModel $column */
50
-            if($data_row) {
50
+            if ($data_row) {
51 51
                 $value = $data_row->{ $column->getField() };
52
-            }else{
52
+            } else {
53 53
                 $value = request($column->getName());
54 54
 
55
-                if(!$value && $column->getDefaultValue()) {
55
+                if (!$value && $column->getDefaultValue()) {
56 56
                     $value = $column->getDefaultValue();
57 57
                 }
58 58
 
@@ -68,9 +68,9 @@  discard block
 block discarded – undo
68 68
     {
69 69
         $data = $this->columns;
70 70
         $newData = [];
71
-        foreach($data as $i=>$item) {
71
+        foreach ($data as $i=>$item) {
72 72
             /** @var ColumnModel $item */
73
-            if($item->getShowIndex()) {
73
+            if ($item->getShowIndex()) {
74 74
                 $newData[] = $item;
75 75
             }
76 76
         }
@@ -81,9 +81,9 @@  discard block
 block discarded – undo
81 81
     {
82 82
         $data = $this->columns;
83 83
         $newData = [];
84
-        foreach($data as $i=>$item) {
84
+        foreach ($data as $i=>$item) {
85 85
             /** @var ColumnModel $item */
86
-            if($item->getShowAdd() || $item->getShowEdit()) {
86
+            if ($item->getShowAdd() || $item->getShowEdit()) {
87 87
                 $newData[] = $item;
88 88
             }
89 89
         }
@@ -94,9 +94,9 @@  discard block
 block discarded – undo
94 94
     {
95 95
         $data = $this->columns;
96 96
         $newData = [];
97
-        foreach($data as $i=>$item) {
97
+        foreach ($data as $i=>$item) {
98 98
             /** @var ColumnModel $item */
99
-            if($item->getShowEdit()) {
99
+            if ($item->getShowEdit()) {
100 100
                 $newData[] = $item;
101 101
             }
102 102
         }
@@ -107,9 +107,9 @@  discard block
 block discarded – undo
107 107
     {
108 108
         $data = $this->columns;
109 109
         $newData = [];
110
-        foreach($data as $i=>$item) {
110
+        foreach ($data as $i=>$item) {
111 111
             /** @var ColumnModel $item */
112
-            if($item->getShowAdd()) {
112
+            if ($item->getShowAdd()) {
113 113
                 $newData[] = $item;
114 114
             }
115 115
         }
@@ -120,9 +120,9 @@  discard block
 block discarded – undo
120 120
     {
121 121
         $data = $this->columns;
122 122
         $newData = [];
123
-        foreach($data as $i=>$item) {
123
+        foreach ($data as $i=>$item) {
124 124
             /** @var ColumnModel $item */
125
-            if($item->getShowDetail()) {
125
+            if ($item->getShowDetail()) {
126 126
                 $newData[] = $item;
127 127
             }
128 128
         }
@@ -132,13 +132,13 @@  discard block
 block discarded – undo
132 132
     public function getAssignmentData()
133 133
     {
134 134
         $data = [];
135
-        foreach($this->columns as $column) {
135
+        foreach ($this->columns as $column) {
136 136
             /** @var ColumnModel $column */
137
-            if(is_array($column->getValue())) {
138
-                foreach($column->getValue() as $key=>$val) {
137
+            if (is_array($column->getValue())) {
138
+                foreach ($column->getValue() as $key=>$val) {
139 139
                     $data[$key] = $val;
140 140
                 }
141
-            }else{
141
+            } else {
142 142
                 $data[$column->getField()] = $column->getValue();
143 143
             }
144 144
         }
@@ -148,10 +148,10 @@  discard block
 block discarded – undo
148 148
     public function removeColumn($label_or_name)
149 149
     {
150 150
         $data = $this->getColumns();
151
-        foreach($data as $i=>$d)
151
+        foreach ($data as $i=>$d)
152 152
         {
153 153
             /** @var ColumnModel $d */
154
-            if($d->getLabel() == $label_or_name || $d->getName() == $label_or_name) {
154
+            if ($d->getLabel() == $label_or_name || $d->getName() == $label_or_name) {
155 155
                 unset($data[$i]);
156 156
             }
157 157
         }
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
     public function getColumnNameOnly()
162 162
     {
163 163
         $result = [];
164
-        foreach($this->columns as $column) {
164
+        foreach ($this->columns as $column) {
165 165
             /** @var ColumnModel $column */
166 166
             $result[] = $column->getName();
167 167
         }
Please login to merge, or discard this patch.
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
             /** @var ColumnModel $column */
50 50
             if($data_row) {
51 51
                 $value = $data_row->{ $column->getField() };
52
-            }else{
52
+            } else{
53 53
                 $value = request($column->getName());
54 54
 
55 55
                 if(!$value && $column->getDefaultValue()) {
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
                 foreach($column->getValue() as $key=>$val) {
139 139
                     $data[$key] = $val;
140 140
                 }
141
-            }else{
141
+            } else{
142 142
                 $data[$column->getField()] = $column->getValue();
143 143
             }
144 144
         }
Please login to merge, or discard this patch.
src/CRUDBoosterServiceProvider.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -24,11 +24,11 @@  discard block
 block discarded – undo
24 24
         $this->loadViewsFrom(__DIR__.'/types', 'types');
25 25
 
26 26
         // Publish the files
27
-        $this->publishes([__DIR__.'/configs/crudbooster.php' => config_path('crudbooster.php')],'cb_config');            
27
+        $this->publishes([__DIR__.'/configs/crudbooster.php' => config_path('crudbooster.php')], 'cb_config');            
28 28
         $this->publishes([__DIR__.'/localization' => resource_path('lang')], 'cb_localization');                 
29
-        $this->publishes([__DIR__.'/database' => base_path('database')],'cb_migration');
30
-        $this->publishes([__DIR__.'/templates/CBHook.stub'=> app_path('Http/CBHook.php')],'cb_hook');
31
-        $this->publishes([__DIR__ . '/assets' =>public_path('cb_asset')],'cb_asset');
29
+        $this->publishes([__DIR__.'/database' => base_path('database')], 'cb_migration');
30
+        $this->publishes([__DIR__.'/templates/CBHook.stub'=> app_path('Http/CBHook.php')], 'cb_hook');
31
+        $this->publishes([__DIR__.'/assets' =>public_path('cb_asset')], 'cb_asset');
32 32
                     
33 33
         require __DIR__.'/validations/validation.php';        
34 34
         require __DIR__.'/routes.php';
@@ -46,14 +46,14 @@  discard block
 block discarded – undo
46 46
         require __DIR__.'/helpers/Helper.php';
47 47
 
48 48
         // Singletons
49
-        $this->app->singleton('crudbooster', function ()
49
+        $this->app->singleton('crudbooster', function()
50 50
         {
51 51
             return true;
52 52
         });
53 53
         $this->app->singleton('ColumnSingleton', ColumnSingleton::class);
54 54
 
55 55
         // Merging configuration
56
-        $this->mergeConfigFrom(__DIR__.'/configs/crudbooster.php','crudbooster');
56
+        $this->mergeConfigFrom(__DIR__.'/configs/crudbooster.php', 'crudbooster');
57 57
 
58 58
 
59 59
         // Register Commands
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 
74 74
     private function registerTypeRoutes() {
75 75
         $routes = rglob(__DIR__.DIRECTORY_SEPARATOR."types".DIRECTORY_SEPARATOR."Route.php");
76
-        foreach($routes as $route) {
76
+        foreach ($routes as $route) {
77 77
             require $route;
78 78
         }
79 79
     }
Please login to merge, or discard this patch.
src/types/file/FileController.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -14,21 +14,21 @@
 block discarded – undo
14 14
 {
15 15
     public function postUploadFile()
16 16
     {
17
-        if(auth()->guest()) return redirect(cb()->getLoginUrl());
17
+        if (auth()->guest()) return redirect(cb()->getLoginUrl());
18 18
 
19 19
         $file = null;
20 20
         try {
21 21
 
22 22
             cb()->validation([
23
-                'userfile' => 'required|mimes:' . implode(",",config('crudbooster.UPLOAD_FILE_EXTENSION_ALLOWED'))
23
+                'userfile' => 'required|mimes:'.implode(",", config('crudbooster.UPLOAD_FILE_EXTENSION_ALLOWED'))
24 24
             ]);
25 25
 
26 26
             $file = cb()->uploadFile('userfile', true);
27 27
 
28 28
         } catch (CBValidationException $e) {
29
-            return response()->json(['status'=>false,'message'=>$e->getMessage()]);
29
+            return response()->json(['status'=>false, 'message'=>$e->getMessage()]);
30 30
         } catch (\Exception $e) {
31
-            return response()->json(['status'=>false,'message'=>$e->getMessage()]);
31
+            return response()->json(['status'=>false, 'message'=>$e->getMessage()]);
32 32
         }
33 33
 
34 34
         return response()->json([
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -14,7 +14,9 @@
 block discarded – undo
14 14
 {
15 15
     public function postUploadFile()
16 16
     {
17
-        if(auth()->guest()) return redirect(cb()->getLoginUrl());
17
+        if(auth()->guest()) {
18
+            return redirect(cb()->getLoginUrl());
19
+        }
18 20
 
19 21
         $file = null;
20 22
         try {
Please login to merge, or discard this patch.
src/types/file/Route.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-cb()->routeGroupBackend(function () {
4
-    cb()->routePost("upload-file",'\crocodicstudio\crudbooster\types\file\FileController@postUploadFile');
3
+cb()->routeGroupBackend(function() {
4
+    cb()->routePost("upload-file", '\crocodicstudio\crudbooster\types\file\FileController@postUploadFile');
5 5
 });
6 6
\ No newline at end of file
Please login to merge, or discard this patch.
src/types/radio/component.blade.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@
 block discarded – undo
2 2
         <?php /** @var \crocodicstudio\crudbooster\types\radio\RadioModel $column */ ?>
3 3
         @foreach($column->getOptions() as $key=>$value)
4 4
             <?php
5
-                $columnValue = old($column->getName())?:($column->getDefaultValue())?:$column->getValue();
5
+                $columnValue = old($column->getName()) ?: ($column->getDefaultValue()) ?: $column->getValue();
6 6
             ?>
7 7
             <div class="{{ $column->getDisabled()?"disabled":"" }}">
8 8
                 <label class='radio-inline'>
Please login to merge, or discard this patch.
src/types/wysiwyg/Hook.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@
 block discarded – undo
22 22
     public function indexRender($row, $column)
23 23
     {
24 24
         $value = trim(strip_tags($row->{ $column->getField() }));
25
-        if($column->getLimit()) {
25
+        if ($column->getLimit()) {
26 26
             $value = Str::limit($value, $column->getLimit());
27 27
         }
28 28
         return $value;
Please login to merge, or discard this patch.
src/types/checkbox/Hook.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@
 block discarded – undo
20 20
      */
21 21
     public function assignment($value, $column)
22 22
     {
23
-        return @implode(";", request( $column->getName() ));
23
+        return @implode(";", request($column->getName()));
24 24
     }
25 25
 
26 26
 }
27 27
\ No newline at end of file
Please login to merge, or discard this patch.