Passed
Push — master ( ef5ef1...5403d4 )
by Ferry
08:51
created
src/types/image/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-image",'\crocodicstudio\crudbooster\types\image\ImageController@postUploadImage');
3
+cb()->routeGroupBackend(function() {
4
+    cb()->routePost("upload-image", '\crocodicstudio\crudbooster\types\image\ImageController@postUploadImage');
5 5
 });
6 6
\ No newline at end of file
Please login to merge, or discard this patch.
src/types/image/ImageController.php 2 patches
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 postUploadImage()
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.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -14,21 +14,21 @@
 block discarded – undo
14 14
 {
15 15
     public function postUploadImage()
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_IMAGE_EXTENSION_ALLOWED'))
23
+                'userfile' => 'required|mimes:'.implode(",", config('crudbooster.UPLOAD_IMAGE_EXTENSION_ALLOWED'))
24 24
             ]);
25 25
 
26
-            $file = cb()->uploadFile('userfile', request("encrypt")?true:false, request("resize_width"), request("resize_height"));
26
+            $file = cb()->uploadFile('userfile', request("encrypt") ?true:false, request("resize_width"), request("resize_height"));
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.
src/types/text_area/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/text/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/select/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("select-lookup",'\crocodicstudio\crudbooster\types\select\SelectController@postLookup');
3
+cb()->routeGroupBackend(function() {
4
+    cb()->routePost("select-lookup", '\crocodicstudio\crudbooster\types\select\SelectController@postLookup');
5 5
 });
6 6
\ No newline at end of file
Please login to merge, or discard this patch.
src/types/select/component.blade.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@
 block discarded – undo
8 8
         <option value="">** Select a {{ $column->getLabel() }}</option>
9 9
         @if(!$column->getForeignKey())
10 10
             <?php
11
-                $columnValue = old($column->getName())?:($column->getDefaultValue())?:$column->getValue();
11
+                $columnValue = old($column->getName()) ?: ($column->getDefaultValue()) ?: $column->getValue();
12 12
             ?>
13 13
             @foreach($column->getOptions() as $key=>$value)
14 14
                 <option {{ $columnValue==$key?'selected':'' }} value="{{ $key }}">{{ $value }}</option>
Please login to merge, or discard this patch.
src/controllers/scaffolding/traits/ColumnsRegister.php 1 patch
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -55,8 +55,8 @@  discard block
 block discarded – undo
55 55
         $data = new TextModel();
56 56
         $data = $this->setDefaultModelValue($data);
57 57
         $data->setLabel($label);
58
-        $data->setName($this->name($label,$name));
59
-        $data->setField($field_to_save?:$this->name($label, $name));
58
+        $data->setName($this->name($label, $name));
59
+        $data->setField($field_to_save ?: $this->name($label, $name));
60 60
         $data->setType("text");
61 61
 
62 62
         columnSingleton()->setColumn($this->index, $data);
@@ -71,8 +71,8 @@  discard block
 block discarded – undo
71 71
         $data = new CheckboxModel();
72 72
         $data = $this->setDefaultModelValue($data);
73 73
         $data->setLabel($label);
74
-        $data->setName($this->name($label,$name));
75
-        $data->setField($field_to_save?:$this->name($label, $name));
74
+        $data->setName($this->name($label, $name));
75
+        $data->setField($field_to_save ?: $this->name($label, $name));
76 76
         $data->setType("checkbox");
77 77
 
78 78
         columnSingleton()->setColumn($this->index, $data);
@@ -87,8 +87,8 @@  discard block
 block discarded – undo
87 87
         $data = new PasswordModel();
88 88
         $data = $this->setDefaultModelValue($data);
89 89
         $data->setLabel($label);
90
-        $data->setName($this->name($label,$name));
91
-        $data->setField($field_to_save?:$this->name($label, $name));
90
+        $data->setName($this->name($label, $name));
91
+        $data->setField($field_to_save ?: $this->name($label, $name));
92 92
         $data->setType("password");
93 93
         $data->setShowDetail(false);
94 94
         $data->setShowIndex(false);
@@ -105,8 +105,8 @@  discard block
 block discarded – undo
105 105
         $data = new ImageModel();
106 106
         $data = $this->setDefaultModelValue($data);
107 107
         $data->setLabel($label);
108
-        $data->setName($this->name($label,$name));
109
-        $data->setField($field_to_save?:$this->name($label, $name));
108
+        $data->setName($this->name($label, $name));
109
+        $data->setField($field_to_save ?: $this->name($label, $name));
110 110
         $data->setType("image");
111 111
 
112 112
         columnSingleton()->setColumn($this->index, $data);
@@ -121,8 +121,8 @@  discard block
 block discarded – undo
121 121
         $data = new TextAreaModel();
122 122
         $data = $this->setDefaultModelValue($data);
123 123
         $data->setLabel($label);
124
-        $data->setName($this->name($label,$name));
125
-        $data->setField($field_to_save?:$this->name($label, $name));
124
+        $data->setName($this->name($label, $name));
125
+        $data->setField($field_to_save ?: $this->name($label, $name));
126 126
         $data->setType("text_area");
127 127
 
128 128
         columnSingleton()->setColumn($this->index, $data);
@@ -137,8 +137,8 @@  discard block
 block discarded – undo
137 137
         $data = new SelectModel();
138 138
         $data = $this->setDefaultModelValue($data);
139 139
         $data->setLabel($label);
140
-        $data->setName($this->name($label,$name));
141
-        $data->setField($field_to_save?:$this->name($label, $name));
140
+        $data->setName($this->name($label, $name));
141
+        $data->setField($field_to_save ?: $this->name($label, $name));
142 142
         $data->setType("select");
143 143
 
144 144
         columnSingleton()->setColumn($this->index, $data);
@@ -154,8 +154,8 @@  discard block
 block discarded – undo
154 154
         $data = new CustomModel();
155 155
         $data = $this->setDefaultModelValue($data);
156 156
         $data->setLabel($label);
157
-        $data->setName($this->name($label,$name));
158
-        $data->setField($field_to_save?:$this->name($label, $name));
157
+        $data->setName($this->name($label, $name));
158
+        $data->setField($field_to_save ?: $this->name($label, $name));
159 159
         $data->setType("custom");
160 160
 
161 161
         columnSingleton()->setColumn($this->index, $data);
@@ -170,8 +170,8 @@  discard block
 block discarded – undo
170 170
         $data = new DateModel();
171 171
         $data = $this->setDefaultModelValue($data);
172 172
         $data->setLabel($label);
173
-        $data->setName($this->name($label,$name));
174
-        $data->setField($field_to_save?:$this->name($label, $name));
173
+        $data->setName($this->name($label, $name));
174
+        $data->setField($field_to_save ?: $this->name($label, $name));
175 175
         $data->setType("date");
176 176
 
177 177
         columnSingleton()->setColumn($this->index, $data);
@@ -186,8 +186,8 @@  discard block
 block discarded – undo
186 186
         $data = new DatetimeModel();
187 187
         $data = $this->setDefaultModelValue($data);
188 188
         $data->setLabel($label);
189
-        $data->setName($this->name($label,$name));
190
-        $data->setField($field_to_save?:$this->name($label, $name));
189
+        $data->setName($this->name($label, $name));
190
+        $data->setField($field_to_save ?: $this->name($label, $name));
191 191
         $data->setType("datetime");
192 192
 
193 193
         columnSingleton()->setColumn($this->index, $data);
@@ -202,8 +202,8 @@  discard block
 block discarded – undo
202 202
         $data = new EmailModel();
203 203
         $data = $this->setDefaultModelValue($data);
204 204
         $data->setLabel($label);
205
-        $data->setName($this->name($label,$name));
206
-        $data->setField($field_to_save?:$this->name($label, $name));
205
+        $data->setName($this->name($label, $name));
206
+        $data->setField($field_to_save ?: $this->name($label, $name));
207 207
         $data->setType("email");
208 208
 
209 209
         columnSingleton()->setColumn($this->index, $data);
@@ -218,8 +218,8 @@  discard block
 block discarded – undo
218 218
         $data = new FileModel();
219 219
         $data = $this->setDefaultModelValue($data);
220 220
         $data->setLabel($label);
221
-        $data->setName($this->name($label,$name));
222
-        $data->setField($field_to_save?:$this->name($label, $name));
221
+        $data->setName($this->name($label, $name));
222
+        $data->setField($field_to_save ?: $this->name($label, $name));
223 223
         $data->setType("file");
224 224
 
225 225
         columnSingleton()->setColumn($this->index, $data);
@@ -235,8 +235,8 @@  discard block
 block discarded – undo
235 235
         $data = new HiddenModel();
236 236
         $data = $this->setDefaultModelValue($data);
237 237
         $data->setLabel($label);
238
-        $data->setName($this->name($label,$name));
239
-        $data->setField($field_to_save?:$this->name($label, $name));
238
+        $data->setName($this->name($label, $name));
239
+        $data->setField($field_to_save ?: $this->name($label, $name));
240 240
         $data->setType("hidden");
241 241
 
242 242
         columnSingleton()->setColumn($this->index, $data);
@@ -251,8 +251,8 @@  discard block
 block discarded – undo
251 251
         $data = new NumberModel();
252 252
         $data = $this->setDefaultModelValue($data);
253 253
         $data->setLabel($label);
254
-        $data->setName($this->name($label,$name));
255
-        $data->setField($field_to_save?:$this->name($label, $name));
254
+        $data->setName($this->name($label, $name));
255
+        $data->setField($field_to_save ?: $this->name($label, $name));
256 256
         $data->setType("number");
257 257
 
258 258
         columnSingleton()->setColumn($this->index, $data);
@@ -267,8 +267,8 @@  discard block
 block discarded – undo
267 267
         $data = new MoneyModel();
268 268
         $data = $this->setDefaultModelValue($data);
269 269
         $data->setLabel($label);
270
-        $data->setName($this->name($label,$name));
271
-        $data->setField($field_to_save?:$this->name($label, $name));
270
+        $data->setName($this->name($label, $name));
271
+        $data->setField($field_to_save ?: $this->name($label, $name));
272 272
         $data->setType("money");
273 273
 
274 274
         columnSingleton()->setColumn($this->index, $data);
@@ -283,8 +283,8 @@  discard block
 block discarded – undo
283 283
         $data = new RadioModel();
284 284
         $data = $this->setDefaultModelValue($data);
285 285
         $data->setLabel($label);
286
-        $data->setName($this->name($label,$name));
287
-        $data->setField($field_to_save?:$this->name($label, $name));
286
+        $data->setName($this->name($label, $name));
287
+        $data->setField($field_to_save ?: $this->name($label, $name));
288 288
         $data->setType("radio");
289 289
 
290 290
         columnSingleton()->setColumn($this->index, $data);
@@ -299,8 +299,8 @@  discard block
 block discarded – undo
299 299
         $data = new WysiwygModel();
300 300
         $data = $this->setDefaultModelValue($data);
301 301
         $data->setLabel($label);
302
-        $data->setName($this->name($label,$name));
303
-        $data->setField($field_to_save?:$this->name($label, $name));
302
+        $data->setName($this->name($label, $name));
303
+        $data->setField($field_to_save ?: $this->name($label, $name));
304 304
         $data->setType("wysiwyg");
305 305
 
306 306
         columnSingleton()->setColumn($this->index, $data);
Please login to merge, or discard this patch.
src/types/money/Hook.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -21,16 +21,16 @@
 block discarded – undo
21 21
      */
22 22
     public function assignment($value, $column)
23 23
     {
24
-        $value = str_replace($column->getThousands()?:",","", $value);
25
-        $value = str_replace($column->getDecimal()?:".",".",$value);
24
+        $value = str_replace($column->getThousands() ?: ",", "", $value);
25
+        $value = str_replace($column->getDecimal() ?: ".", ".", $value);
26 26
         return $value;
27 27
     }
28 28
 
29 29
     public function indexRender($row, $column)
30 30
     {
31 31
         $value = $row->{$column->getField()};
32
-        $prefix = ($column->getPrefix())?:"";
33
-        return $prefix.number_format($value, $column->getPrecision()?:0, $column->getDecimal()?:".", $column->getThousands()?:",");
32
+        $prefix = ($column->getPrefix()) ?: "";
33
+        return $prefix.number_format($value, $column->getPrecision() ?: 0, $column->getDecimal() ?: ".", $column->getThousands() ?: ",");
34 34
     }
35 35
 
36 36
     public function detailRender($row, $column)
Please login to merge, or discard this patch.
src/controllers/scaffolding/singletons/ColumnSingleton.php 2 patches
Spacing   +22 added lines, -22 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) {
51
-                $value = (isset($data_row->{$column->getField()}))?$data_row->{ $column->getField() }:null;
52
-            }else{
50
+            if ($data_row) {
51
+                $value = (isset($data_row->{$column->getField()})) ? $data_row->{ $column->getField() }:null;
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,14 +132,14 @@  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 137
 
138
-            if(is_array($column->getValue())) {
139
-                foreach($column->getValue() as $key=>$val) {
138
+            if (is_array($column->getValue())) {
139
+                foreach ($column->getValue() as $key=>$val) {
140 140
                     $data[$key] = $val;
141 141
                 }
142
-            }else{
142
+            } else {
143 143
                 $data[$column->getField()] = $column->getValue();
144 144
             }
145 145
         }
@@ -149,10 +149,10 @@  discard block
 block discarded – undo
149 149
     public function removeColumn($label_or_name)
150 150
     {
151 151
         $data = $this->getColumns();
152
-        foreach($data as $i=>$d)
152
+        foreach ($data as $i=>$d)
153 153
         {
154 154
             /** @var ColumnModel $d */
155
-            if($d->getLabel() == $label_or_name || $d->getName() == $label_or_name) {
155
+            if ($d->getLabel() == $label_or_name || $d->getName() == $label_or_name) {
156 156
                 unset($data[$i]);
157 157
             }
158 158
         }
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
     public function getColumnNameOnly()
163 163
     {
164 164
         $result = [];
165
-        foreach($this->columns as $column) {
165
+        foreach ($this->columns as $column) {
166 166
             /** @var ColumnModel $column */
167 167
             $result[] = $column->getName();
168 168
         }
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 = (isset($data_row->{$column->getField()}))?$data_row->{ $column->getField() }:null;
52
-            }else{
52
+            } else{
53 53
                 $value = request($column->getName());
54 54
 
55 55
                 if(!$value && $column->getDefaultValue()) {
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
                 foreach($column->getValue() as $key=>$val) {
140 140
                     $data[$key] = $val;
141 141
                 }
142
-            }else{
142
+            } else{
143 143
                 $data[$column->getField()] = $column->getValue();
144 144
             }
145 145
         }
Please login to merge, or discard this patch.