Passed
Push — master ( 6b3304...34df25 )
by Ferry
03:52
created
src/controllers/SubModuleController.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -14,16 +14,16 @@  discard block
 block discarded – undo
14 14
 {
15 15
 
16 16
     public function getSubModule($subModuleKey) {
17
-        if(!module()->canBrowse()) return cb()->redirect(cb()->getAdminUrl(),cbLang("you_dont_have_privilege_to_this_area"));
18
-        if(!verifyReferalUrl()) return cb()->redirect(module()->url(),"It looks like your url is incorrect");
17
+        if (!module()->canBrowse()) return cb()->redirect(cb()->getAdminUrl(), cbLang("you_dont_have_privilege_to_this_area"));
18
+        if (!verifyReferalUrl()) return cb()->redirect(module()->url(), "It looks like your url is incorrect");
19 19
 
20
-        if($subModule = Cache::get("subModule".$subModuleKey)) {
20
+        if ($subModule = Cache::get("subModule".$subModuleKey)) {
21 21
             $foreignKey = $subModule['foreignKey'];
22 22
             $foreignValue = $subModule['foreignValue'];
23 23
 
24 24
             $query = $this->repository();
25 25
             $query->where($foreignKey, $foreignValue);
26
-            $result = $query->paginate( request("limit")?:cbConfig("LIMIT_TABLE_DATA") );
26
+            $result = $query->paginate(request("limit") ?: cbConfig("LIMIT_TABLE_DATA"));
27 27
             $data['result'] = $result;
28 28
 
29 29
             $data['additionalHeaderTitle'] = $subModule['parentTitle'];
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
             return view("crudbooster::module.index.index", array_merge($data, $this->data));
34 34
         }
35 35
 
36
-        return cb()->redirect(module()->url(),"It looks like your url is incorrect");
36
+        return cb()->redirect(module()->url(), "It looks like your url is incorrect");
37 37
     }
38 38
 
39 39
 }
40 40
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -14,8 +14,12 @@
 block discarded – undo
14 14
 {
15 15
 
16 16
     public function getSubModule($subModuleKey) {
17
-        if(!module()->canBrowse()) return cb()->redirect(cb()->getAdminUrl(),cbLang("you_dont_have_privilege_to_this_area"));
18
-        if(!verifyReferalUrl()) return cb()->redirect(module()->url(),"It looks like your url is incorrect");
17
+        if(!module()->canBrowse()) {
18
+            return cb()->redirect(cb()->getAdminUrl(),cbLang("you_dont_have_privilege_to_this_area"));
19
+        }
20
+        if(!verifyReferalUrl()) {
21
+            return cb()->redirect(module()->url(),"It looks like your url is incorrect");
22
+        }
19 23
 
20 24
         if($subModule = Cache::get("subModule".$subModuleKey)) {
21 25
             $foreignKey = $subModule['foreignKey'];
Please login to merge, or discard this patch.
src/controllers/CBController.php 2 patches
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -32,10 +32,10 @@  discard block
 block discarded – undo
32 32
 
33 33
     public function getIndex()
34 34
     {
35
-        if(!module()->canBrowse()) return cb()->redirect(cb()->getAdminUrl(),cbLang("you_dont_have_privilege_to_this_area"));
35
+        if (!module()->canBrowse()) return cb()->redirect(cb()->getAdminUrl(), cbLang("you_dont_have_privilege_to_this_area"));
36 36
 
37 37
         $query = $this->repository();
38
-        $result = $query->paginate( request("limit")?:cbConfig("LIMIT_TABLE_DATA") );
38
+        $result = $query->paginate(request("limit") ?: cbConfig("LIMIT_TABLE_DATA"));
39 39
         $data['result'] = $result;
40 40
 
41 41
         return view("crudbooster::module.index.index", array_merge($data, $this->data));
@@ -43,17 +43,17 @@  discard block
 block discarded – undo
43 43
 
44 44
     public function getAdd()
45 45
     {
46
-        if(!module()->canCreate()) return cb()->redirect(cb()->getAdminUrl(),cbLang("you_dont_have_privilege_to_this_area"));
46
+        if (!module()->canCreate()) return cb()->redirect(cb()->getAdminUrl(), cbLang("you_dont_have_privilege_to_this_area"));
47 47
 
48 48
         $data = [];
49 49
         $data['page_title'] = $this->data['page_title'].' : '.cbLang('add');
50 50
         $data['action_url'] = module()->addSaveURL();
51
-        return view('crudbooster::module.form.form',array_merge($data, $this->data));
51
+        return view('crudbooster::module.form.form', array_merge($data, $this->data));
52 52
     }
53 53
 
54 54
     public function postAddSave()
55 55
     {
56
-        if(!module()->canCreate()) return cb()->redirect(cb()->getAdminUrl(),cbLang("you_dont_have_privilege_to_this_area"));
56
+        if (!module()->canCreate()) return cb()->redirect(cb()->getAdminUrl(), cbLang("you_dont_have_privilege_to_this_area"));
57 57
 
58 58
         try {
59 59
             $this->validation();
@@ -61,38 +61,38 @@  discard block
 block discarded – undo
61 61
             $data = columnSingleton()->getAssignmentData();
62 62
 
63 63
             //Clear data from Primary Key
64
-            unset($data[ cb()->pk($this->data['table']) ]);
64
+            unset($data[cb()->pk($this->data['table'])]);
65 65
 
66
-            if(Schema::hasColumn($this->data['table'], 'created_at')) {
66
+            if (Schema::hasColumn($this->data['table'], 'created_at')) {
67 67
                 $data['created_at'] = date('Y-m-d H:i:s');
68 68
             }
69 69
 
70
-            if(Schema::hasColumn($this->data['table'], 'updated_at')) {
70
+            if (Schema::hasColumn($this->data['table'], 'updated_at')) {
71 71
                 $data['updated_at'] = date('Y-m-d H:i:s');
72 72
             }
73 73
 
74
-            if(isset($this->data['hook_before_insert']) && is_callable($this->data['hook_before_insert'])) {
74
+            if (isset($this->data['hook_before_insert']) && is_callable($this->data['hook_before_insert'])) {
75 75
                 $data = call_user_func($this->data['hook_before_insert'], $data);
76 76
             }
77 77
 
78 78
             $id = DB::table($this->data['table'])->insertGetId($data);
79 79
 
80
-            if(isset($this->data['hook_after_insert']) && is_callable($this->data['hook_after_insert'])) {
80
+            if (isset($this->data['hook_after_insert']) && is_callable($this->data['hook_after_insert'])) {
81 81
                 call_user_func($this->data['hook_after_insert'], $id);
82 82
             }
83 83
 
84 84
         } catch (CBValidationException $e) {
85 85
             Log::debug($e);
86
-            return cb()->redirectBack($e->getMessage(),'info');
86
+            return cb()->redirectBack($e->getMessage(), 'info');
87 87
         } catch (\Exception $e) {
88 88
             Log::error($e);
89
-            return cb()->redirectBack(cbLang("something_went_wrong"),'warning');
89
+            return cb()->redirectBack(cbLang("something_went_wrong"), 'warning');
90 90
         }
91 91
 
92
-        if (Str::contains(request("submit"),cbLang("more"))) {
92
+        if (Str::contains(request("submit"), cbLang("more"))) {
93 93
             return cb()->redirectBack(cbLang("the_data_has_been_added"), 'success');
94 94
         } else {
95
-            if(verifyReferalUrl()) {
95
+            if (verifyReferalUrl()) {
96 96
                 return cb()->redirect(getReferalUrl("url"), cbLang("the_data_has_been_added"), 'success');
97 97
             } else {
98 98
                 return cb()->redirect(module()->url(), cbLang("the_data_has_been_added"), 'success');
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 
103 103
     public function getEdit($id)
104 104
     {
105
-        if(!module()->canUpdate()) return cb()->redirect(cb()->getAdminUrl(),cbLang("you_dont_have_privilege_to_this_area"));
105
+        if (!module()->canUpdate()) return cb()->redirect(cb()->getAdminUrl(), cbLang("you_dont_have_privilege_to_this_area"));
106 106
 
107 107
         $data = [];
108 108
         $data['row'] = $this->repository()->where($this->data['table'].'.'.getPrimaryKey($this->data['table']), $id)->first();
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 
114 114
     public function postEditSave($id)
115 115
     {
116
-        if(!module()->canUpdate()) return cb()->redirect(cb()->getAdminUrl(),cbLang("you_dont_have_privilege_to_this_area"));
116
+        if (!module()->canUpdate()) return cb()->redirect(cb()->getAdminUrl(), cbLang("you_dont_have_privilege_to_this_area"));
117 117
 
118 118
         try {
119 119
             $this->validation();
@@ -121,40 +121,40 @@  discard block
 block discarded – undo
121 121
             $data = columnSingleton()->getAssignmentData();
122 122
 
123 123
             // Make sure the Primary Key is not included
124
-            unset($data[ cb()->pk($this->data['table']) ]);
124
+            unset($data[cb()->pk($this->data['table'])]);
125 125
 
126
-            if(Schema::hasColumn($this->data['table'], 'updated_at')) {
126
+            if (Schema::hasColumn($this->data['table'], 'updated_at')) {
127 127
                 $data['updated_at'] = date('Y-m-d H:i:s');
128 128
             }
129 129
 
130 130
             unset($data['created_at']);
131 131
 
132
-            if(isset($this->data['hook_before_update']) && is_callable($this->data['hook_before_update'])) {
132
+            if (isset($this->data['hook_before_update']) && is_callable($this->data['hook_before_update'])) {
133 133
                 $data = call_user_func($this->data['hook_before_update'], $id, $data);
134 134
             }
135 135
 
136 136
             cb()->update($this->data['table'], $id, $data);
137 137
 
138
-            if(isset($this->data['hook_after_update']) && is_callable($this->data['hook_after_update'])) {
138
+            if (isset($this->data['hook_after_update']) && is_callable($this->data['hook_after_update'])) {
139 139
                 call_user_func($this->data['hook_after_update'], $id);
140 140
             }
141 141
 
142 142
         } catch (CBValidationException $e) {
143 143
             Log::debug($e);
144
-            return cb()->redirectBack($e->getMessage(),'info');
144
+            return cb()->redirectBack($e->getMessage(), 'info');
145 145
         } catch (\Exception $e) {
146 146
             Log::error($e);
147
-            return cb()->redirectBack(cbLang("something_went_wrong"),'warning');
147
+            return cb()->redirectBack(cbLang("something_went_wrong"), 'warning');
148 148
         }
149 149
 
150 150
 
151 151
         if (Str::contains(request("submit"), cbLang("more"))) {
152
-            return cb()->redirectBack( cbLang("the_data_has_been_updated"), 'success');
152
+            return cb()->redirectBack(cbLang("the_data_has_been_updated"), 'success');
153 153
         } else {
154
-            if(verifyReferalUrl()) {
155
-                return cb()->redirect(getReferalUrl("url"),  cbLang("the_data_has_been_updated"), 'success');
154
+            if (verifyReferalUrl()) {
155
+                return cb()->redirect(getReferalUrl("url"), cbLang("the_data_has_been_updated"), 'success');
156 156
             } else {
157
-                return cb()->redirect(module()->url(),  cbLang("the_data_has_been_updated"), 'success');
157
+                return cb()->redirect(module()->url(), cbLang("the_data_has_been_updated"), 'success');
158 158
             }
159 159
 
160 160
         }
@@ -162,15 +162,15 @@  discard block
 block discarded – undo
162 162
 
163 163
     public function getDelete($id)
164 164
     {
165
-        if(!module()->canDelete()) return cb()->redirect(cb()->getAdminUrl(),cbLang("you_dont_have_privilege_to_this_area"));
165
+        if (!module()->canDelete()) return cb()->redirect(cb()->getAdminUrl(), cbLang("you_dont_have_privilege_to_this_area"));
166 166
 
167
-        if(isset($this->data['hook_before_delete']) && is_callable($this->data['hook_before_delete'])) {
167
+        if (isset($this->data['hook_before_delete']) && is_callable($this->data['hook_before_delete'])) {
168 168
             call_user_func($this->data['hook_before_delete'], $id);
169 169
         }
170 170
 
171
-        $softDelete = isset($this->data['disable_soft_delete'])?$this->data['disable_soft_delete']:true;
171
+        $softDelete = isset($this->data['disable_soft_delete']) ? $this->data['disable_soft_delete'] : true;
172 172
 
173
-        if ($softDelete === true && Schema::hasColumn($this->data['table'],'deleted_at')) {
173
+        if ($softDelete === true && Schema::hasColumn($this->data['table'], 'deleted_at')) {
174 174
             DB::table($this->data['table'])
175 175
                 ->where(getPrimaryKey($this->data['table']), $id)
176 176
                 ->update(['deleted_at' => date('Y-m-d H:i:s')]);
@@ -180,16 +180,16 @@  discard block
 block discarded – undo
180 180
                 ->delete();
181 181
         }
182 182
 
183
-        if(isset($this->data['hook_after_delete']) && is_callable($this->data['hook_after_delete'])) {
183
+        if (isset($this->data['hook_after_delete']) && is_callable($this->data['hook_after_delete'])) {
184 184
             call_user_func($this->data['hook_after_delete'], $id);
185 185
         }
186 186
 
187
-        return cb()->redirectBack( cbLang("the_data_has_been_deleted"), 'success');
187
+        return cb()->redirectBack(cbLang("the_data_has_been_deleted"), 'success');
188 188
     }
189 189
 
190 190
     public function getDetail($id)
191 191
     {
192
-        if(!module()->canRead()) return cb()->redirect(cb()->getAdminUrl(),cbLang("you_dont_have_privilege_to_this_area"));
192
+        if (!module()->canRead()) return cb()->redirect(cb()->getAdminUrl(), cbLang("you_dont_have_privilege_to_this_area"));
193 193
 
194 194
         $data = [];
195 195
         $data['row'] = $this->repository()->where($this->data['table'].'.'.cb()->findPrimaryKey($this->data['table']), $id)->first();
@@ -208,14 +208,14 @@  discard block
 block discarded – undo
208 208
      */
209 209
     public function __call($method, $parameters)
210 210
     {
211
-        if($method == "getData") {
211
+        if ($method == "getData") {
212 212
             $key = $parameters[0];
213
-            if(isset($this->data[$key])) {
213
+            if (isset($this->data[$key])) {
214 214
                 return $this->data[$key];
215
-            }else{
215
+            } else {
216 216
                 return null;
217 217
             }
218
-        }else{
218
+        } else {
219 219
             return null;
220 220
         }
221 221
     }
Please login to merge, or discard this patch.
Braces   +23 added lines, -9 removed lines patch added patch discarded remove patch
@@ -32,7 +32,9 @@  discard block
 block discarded – undo
32 32
 
33 33
     public function getIndex()
34 34
     {
35
-        if(!module()->canBrowse()) return cb()->redirect(cb()->getAdminUrl(),cbLang("you_dont_have_privilege_to_this_area"));
35
+        if(!module()->canBrowse()) {
36
+            return cb()->redirect(cb()->getAdminUrl(),cbLang("you_dont_have_privilege_to_this_area"));
37
+        }
36 38
 
37 39
         $query = $this->repository();
38 40
         $result = $query->paginate( request("limit")?:cbConfig("LIMIT_TABLE_DATA") );
@@ -43,7 +45,9 @@  discard block
 block discarded – undo
43 45
 
44 46
     public function getAdd()
45 47
     {
46
-        if(!module()->canCreate()) return cb()->redirect(cb()->getAdminUrl(),cbLang("you_dont_have_privilege_to_this_area"));
48
+        if(!module()->canCreate()) {
49
+            return cb()->redirect(cb()->getAdminUrl(),cbLang("you_dont_have_privilege_to_this_area"));
50
+        }
47 51
 
48 52
         $data = [];
49 53
         $data['page_title'] = $this->data['page_title'].' : '.cbLang('add');
@@ -53,7 +57,9 @@  discard block
 block discarded – undo
53 57
 
54 58
     public function postAddSave()
55 59
     {
56
-        if(!module()->canCreate()) return cb()->redirect(cb()->getAdminUrl(),cbLang("you_dont_have_privilege_to_this_area"));
60
+        if(!module()->canCreate()) {
61
+            return cb()->redirect(cb()->getAdminUrl(),cbLang("you_dont_have_privilege_to_this_area"));
62
+        }
57 63
 
58 64
         try {
59 65
             $this->validation();
@@ -102,7 +108,9 @@  discard block
 block discarded – undo
102 108
 
103 109
     public function getEdit($id)
104 110
     {
105
-        if(!module()->canUpdate()) return cb()->redirect(cb()->getAdminUrl(),cbLang("you_dont_have_privilege_to_this_area"));
111
+        if(!module()->canUpdate()) {
112
+            return cb()->redirect(cb()->getAdminUrl(),cbLang("you_dont_have_privilege_to_this_area"));
113
+        }
106 114
 
107 115
         $data = [];
108 116
         $data['row'] = $this->repository()->where($this->data['table'].'.'.getPrimaryKey($this->data['table']), $id)->first();
@@ -113,7 +121,9 @@  discard block
 block discarded – undo
113 121
 
114 122
     public function postEditSave($id)
115 123
     {
116
-        if(!module()->canUpdate()) return cb()->redirect(cb()->getAdminUrl(),cbLang("you_dont_have_privilege_to_this_area"));
124
+        if(!module()->canUpdate()) {
125
+            return cb()->redirect(cb()->getAdminUrl(),cbLang("you_dont_have_privilege_to_this_area"));
126
+        }
117 127
 
118 128
         try {
119 129
             $this->validation();
@@ -162,7 +172,9 @@  discard block
 block discarded – undo
162 172
 
163 173
     public function getDelete($id)
164 174
     {
165
-        if(!module()->canDelete()) return cb()->redirect(cb()->getAdminUrl(),cbLang("you_dont_have_privilege_to_this_area"));
175
+        if(!module()->canDelete()) {
176
+            return cb()->redirect(cb()->getAdminUrl(),cbLang("you_dont_have_privilege_to_this_area"));
177
+        }
166 178
 
167 179
         if(isset($this->data['hook_before_delete']) && is_callable($this->data['hook_before_delete'])) {
168 180
             call_user_func($this->data['hook_before_delete'], $id);
@@ -189,7 +201,9 @@  discard block
 block discarded – undo
189 201
 
190 202
     public function getDetail($id)
191 203
     {
192
-        if(!module()->canRead()) return cb()->redirect(cb()->getAdminUrl(),cbLang("you_dont_have_privilege_to_this_area"));
204
+        if(!module()->canRead()) {
205
+            return cb()->redirect(cb()->getAdminUrl(),cbLang("you_dont_have_privilege_to_this_area"));
206
+        }
193 207
 
194 208
         $data = [];
195 209
         $data['row'] = $this->repository()->where($this->data['table'].'.'.cb()->findPrimaryKey($this->data['table']), $id)->first();
@@ -212,10 +226,10 @@  discard block
 block discarded – undo
212 226
             $key = $parameters[0];
213 227
             if(isset($this->data[$key])) {
214 228
                 return $this->data[$key];
215
-            }else{
229
+            } else{
216 230
                 return null;
217 231
             }
218
-        }else{
232
+        } else{
219 233
             return null;
220 234
         }
221 235
     }
Please login to merge, or discard this patch.
src/controllers/traits/ColumnIntervention.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -18,14 +18,14 @@
 block discarded – undo
18 18
      */
19 19
     public function columnIntervention()
20 20
     {
21
-        if(request("sub_module") && Cache::has("subModule".request("sub_module")) && cb()->getCurrentMethod() != "getDetail") {
21
+        if (request("sub_module") && Cache::has("subModule".request("sub_module")) && cb()->getCurrentMethod() != "getDetail") {
22 22
             /*
23 23
              * If there is sub module, the column that has same name with foreign key should be remove
24 24
              * And change to hidden. So we can save the foreign Key id from the parent module.
25 25
              */
26 26
             $subModule = Cache::get("subModule".request("sub_module"));
27 27
             $this->removeColumn($subModule["foreignKey"])
28
-                ->addHidden($subModule["foreignKey"],$subModule['foreignKey'])
28
+                ->addHidden($subModule["foreignKey"], $subModule['foreignKey'])
29 29
                 ->defaultValue($subModule['foreignValue']);
30 30
         }
31 31
     }
Please login to merge, or discard this patch.
src/controllers/traits/ControllerSetting.php 2 patches
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -202,13 +202,13 @@  discard block
 block discarded – undo
202 202
         $parentPath = $this->getData("permalink");
203 203
         $parentTitle = $this->getData("page_title");
204 204
         $this->addActionButton($label,function($row) use ($label, $controllerName, $foreignKey, $additionalInfo, $parentPath, $parentTitle) {
205
-           $actionParameters = [
206
-               "label"=>$label,
207
-               "foreignKey"=>$foreignKey,
208
-               "foreignValue"=>$row->primary_key,
209
-               "parentPath"=>$parentPath,
210
-               "parentTitle"=>$parentTitle
211
-           ];
205
+            $actionParameters = [
206
+                "label"=>$label,
207
+                "foreignKey"=>$foreignKey,
208
+                "foreignValue"=>$row->primary_key,
209
+                "parentPath"=>$parentPath,
210
+                "parentTitle"=>$parentTitle
211
+            ];
212 212
 
213 213
             if(isset($additionalInfo) && is_callable($additionalInfo)) {
214 214
                 $additionalInfo = call_user_func($additionalInfo, $row);
@@ -217,15 +217,15 @@  discard block
 block discarded – undo
217 217
                 }
218 218
             }
219 219
 
220
-           $actionHash = md5(serialize($actionParameters));
221
-           $actionHashToken = Cache::get("subModule".$actionHash);
222
-           if(!$actionHashToken) {
223
-               $actionHashToken = Str::random(5);
224
-               Cache::forever("subModule".$actionHash, $actionHashToken);
225
-               Cache::forever("subModule".$actionHashToken, $actionParameters);
226
-           }
220
+            $actionHash = md5(serialize($actionParameters));
221
+            $actionHashToken = Cache::get("subModule".$actionHash);
222
+            if(!$actionHashToken) {
223
+                $actionHashToken = Str::random(5);
224
+                Cache::forever("subModule".$actionHash, $actionHashToken);
225
+                Cache::forever("subModule".$actionHashToken, $actionParameters);
226
+            }
227 227
 
228
-           return action(class_basename($controllerName)."@getSubModule",['subModuleKey'=>$actionHashToken])."?ref=".makeReferalUrl($parentTitle);
228
+            return action(class_basename($controllerName)."@getSubModule",['subModuleKey'=>$actionHashToken])."?ref=".makeReferalUrl($parentTitle);
229 229
         }, $condition, $font, $color);
230 230
 
231 231
     }
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -32,11 +32,11 @@  discard block
 block discarded – undo
32 32
         $this->setButtonDetail(true);
33 33
         $this->setButtonSave(true);
34 34
         $this->setButtonLimitPage(true);
35
-        $this->hideButtonDeleteWhen(function ($row) { return false; });
36
-        $this->hideButtonDetailWhen(function ($row) { return false; });
37
-        $this->hideButtonEditWhen(function ($row) { return false; });
38
-        $this->style(function () { return null; });
39
-        $this->javascript(function () { return null; });
35
+        $this->hideButtonDeleteWhen(function($row) { return false; });
36
+        $this->hideButtonDetailWhen(function($row) { return false; });
37
+        $this->hideButtonEditWhen(function($row) { return false; });
38
+        $this->style(function() { return null; });
39
+        $this->javascript(function() { return null; });
40 40
     }
41 41
 
42 42
     public function style(callable $style) {
@@ -140,9 +140,9 @@  discard block
 block discarded – undo
140 140
      * @param ButtonColor $color
141 141
      * @param string $attributes
142 142
      */
143
-    public function addIndexActionButton($label, $actionURL, $fontAwesome_icon=null, $color=null, $attributes = null)
143
+    public function addIndexActionButton($label, $actionURL, $fontAwesome_icon = null, $color = null, $attributes = null)
144 144
     {
145
-        $color = ($color)?:ButtonColor::DARK_BLUE;
145
+        $color = ($color) ?: ButtonColor::DARK_BLUE;
146 146
 
147 147
         $model = new IndexActionButtonModel();
148 148
         $model->setLabel($label);
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
     public function addSubModule($label, $controllerName, $foreignKey, callable $additionalInfo = null, callable $condition = null, $font = null, $color = null) {
202 202
         $parentPath = $this->getData("permalink");
203 203
         $parentTitle = $this->getData("page_title");
204
-        $this->addActionButton($label,function($row) use ($label, $controllerName, $foreignKey, $additionalInfo, $parentPath, $parentTitle) {
204
+        $this->addActionButton($label, function($row) use ($label, $controllerName, $foreignKey, $additionalInfo, $parentPath, $parentTitle) {
205 205
            $actionParameters = [
206 206
                "label"=>$label,
207 207
                "foreignKey"=>$foreignKey,
@@ -210,22 +210,22 @@  discard block
 block discarded – undo
210 210
                "parentTitle"=>$parentTitle
211 211
            ];
212 212
 
213
-            if(isset($additionalInfo) && is_callable($additionalInfo)) {
213
+            if (isset($additionalInfo) && is_callable($additionalInfo)) {
214 214
                 $additionalInfo = call_user_func($additionalInfo, $row);
215
-                if(is_array($additionalInfo)) {
215
+                if (is_array($additionalInfo)) {
216 216
                     $actionParameters['info'] = $additionalInfo;
217 217
                 }
218 218
             }
219 219
 
220 220
            $actionHash = md5(serialize($actionParameters));
221 221
            $actionHashToken = Cache::get("subModule".$actionHash);
222
-           if(!$actionHashToken) {
222
+           if (!$actionHashToken) {
223 223
                $actionHashToken = Str::random(5);
224 224
                Cache::forever("subModule".$actionHash, $actionHashToken);
225 225
                Cache::forever("subModule".$actionHashToken, $actionParameters);
226 226
            }
227 227
 
228
-           return action(class_basename($controllerName)."@getSubModule",['subModuleKey'=>$actionHashToken])."?ref=".makeReferalUrl($parentTitle);
228
+           return action(class_basename($controllerName)."@getSubModule", ['subModuleKey'=>$actionHashToken])."?ref=".makeReferalUrl($parentTitle);
229 229
         }, $condition, $font, $color);
230 230
 
231 231
     }
@@ -238,12 +238,12 @@  discard block
 block discarded – undo
238 238
      * @param $fontAwesome_icon
239 239
      * @param ButtonColor|string $color
240 240
      */
241
-    public function addActionButton($label, $url_target, $condition_callback=null, $fontAwesome_icon=null, $color=null, $confirmation = false)
241
+    public function addActionButton($label, $url_target, $condition_callback = null, $fontAwesome_icon = null, $color = null, $confirmation = false)
242 242
     {
243 243
         $new = new AddActionButtonModel();
244 244
         $new->setLabel($label);
245
-        $new->setIcon($fontAwesome_icon?:"fa fa-bars");
246
-        $new->setColor($color?:"primary");
245
+        $new->setIcon($fontAwesome_icon ?: "fa fa-bars");
246
+        $new->setColor($color ?: "primary");
247 247
         $new->setUrl($url_target);
248 248
         $new->setCondition($condition_callback);
249 249
         $new->setConfirmation($confirmation);
Please login to merge, or discard this patch.
src/controllers/traits/Validation.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -19,12 +19,12 @@
 block discarded – undo
19 19
      */
20 20
     private function validation()
21 21
     {
22
-        if(isset($this->data['validation'])) {
22
+        if (isset($this->data['validation'])) {
23 23
             $validator = Validator::make(request()->all(), @$this->data['validation'], @$this->data['validation_messages']);
24 24
             if ($validator->fails()) {
25 25
                 $message = $validator->messages();
26 26
                 $message_all = $message->all();
27
-                throw new CBValidationException(implode(', ',$message_all));
27
+                throw new CBValidationException(implode(', ', $message_all));
28 28
             }
29 29
         }
30 30
     }
Please login to merge, or discard this patch.
src/helpers/MiscellanousSingleton.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@
 block discarded – undo
23 23
 
24 24
     public function hasData($key) {
25 25
         $data = $this->data;
26
-        if(isset($data[$key])) return true;
26
+        if (isset($data[$key])) return true;
27 27
         else return false;
28 28
     }
29 29
 
Please login to merge, or discard this patch.
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -23,8 +23,11 @@
 block discarded – undo
23 23
 
24 24
     public function hasData($key) {
25 25
         $data = $this->data;
26
-        if(isset($data[$key])) return true;
27
-        else return false;
26
+        if(isset($data[$key])) {
27
+            return true;
28
+        } else {
29
+            return false;
30
+        }
28 31
     }
29 32
 
30 33
     public function setData($key, $value): void
Please login to merge, or discard this patch.
src/helpers/SchemaHelper.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -16,6 +16,6 @@
 block discarded – undo
16 16
     public static function hasColumn($table, $column)
17 17
     {
18 18
         $columns = cb()->listAllColumns($table);
19
-        return in_array($column,$columns);
19
+        return in_array($column, $columns);
20 20
     }
21 21
 }
22 22
\ No newline at end of file
Please login to merge, or discard this patch.
src/helpers/CB.php 2 patches
Braces   +26 added lines, -12 removed lines patch added patch discarded remove patch
@@ -100,14 +100,14 @@  discard block
 block discarded – undo
100 100
             if($resize_width || $resize_height) {
101 101
                 $this->resizeImage($file, $file_path.'/'.$filename, $resize_width, $resize_height);
102 102
                 return $file_path.'/'.$filename;
103
-            }else{
103
+            } else{
104 104
                 if (Storage::putFileAs($file_path, $file, $filename, 'public')) {
105 105
                     return $file_path.'/'.$filename;
106 106
                 } else {
107 107
                     throw new \Exception("Something went wrong, file can't upload!");
108 108
                 }
109 109
             }
110
-        }else{
110
+        } else{
111 111
             throw new \Exception("The file format is not allowed!");
112 112
         }
113 113
     }
@@ -129,10 +129,10 @@  discard block
 block discarded – undo
129 129
                 if($filename && $ext) {
130 130
                     return $this->uploadFileProcess($filename, $ext, $fileData, $encrypt, $resize_width, $resize_height);
131 131
                 }
132
-            }else {
132
+            } else {
133 133
                 throw new \Exception("Mime type not found");
134 134
             }
135
-        }else{
135
+        } else{
136 136
             throw new \Exception("Mime type not found");
137 137
         }
138 138
     }
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
             }
210 210
 
211 211
             Storage::put($fullFilePath, $img, 'public');
212
-        }else{
212
+        } else{
213 213
             throw new \Exception("The file format is not allowed!");
214 214
         }
215 215
     }
@@ -233,7 +233,9 @@  discard block
 block discarded – undo
233 233
     {
234 234
         if (is_array($id)) {
235 235
             $idHash = md5("find".$table.serialize($id));
236
-            if(miscellanousSingleton()->hasData($idHash)) return miscellanousSingleton()->getData($idHash);
236
+            if(miscellanousSingleton()->hasData($idHash)) {
237
+                return miscellanousSingleton()->getData($idHash);
238
+            }
237 239
 
238 240
             $first = DB::table($table);
239 241
             foreach ($id as $k => $v) {
@@ -245,7 +247,9 @@  discard block
 block discarded – undo
245 247
             return $data;
246 248
         } else {
247 249
             $idHash = md5("find".$table.$id);
248
-            if(miscellanousSingleton()->hasData($idHash)) return miscellanousSingleton()->getData($idHash);
250
+            if(miscellanousSingleton()->hasData($idHash)) {
251
+                return miscellanousSingleton()->getData($idHash);
252
+            }
249 253
 
250 254
             $pk = $this->pk($table);
251 255
             $data = DB::table($table)->where($pk, $id)->first();
@@ -266,19 +270,25 @@  discard block
 block discarded – undo
266 270
 
267 271
         if(is_array($conditionOrCallback)) {
268 272
             $idHash = md5("findAll".$table.serialize($conditionOrCallback));
269
-            if(miscellanousSingleton()->hasData($idHash)) return miscellanousSingleton()->getData($idHash);
273
+            if(miscellanousSingleton()->hasData($idHash)) {
274
+                return miscellanousSingleton()->getData($idHash);
275
+            }
270 276
 
271 277
             $data = DB::table($table)->where($conditionOrCallback)->get();
272 278
         } elseif (is_callable($conditionOrCallback)) {
273 279
             $idHash = "findAll".$table.spl_object_hash($conditionOrCallback);
274
-            if(miscellanousSingleton()->hasData($idHash)) return miscellanousSingleton()->getData($idHash);
280
+            if(miscellanousSingleton()->hasData($idHash)) {
281
+                return miscellanousSingleton()->getData($idHash);
282
+            }
275 283
 
276 284
             $data = DB::table($table);
277 285
             $data = call_user_func($conditionOrCallback, $data);
278 286
             $data = $data->get();
279 287
         } else {
280 288
             $idHash = md5("findAll".$table.$conditionOrCallback);
281
-            if(miscellanousSingleton()->hasData($idHash)) return miscellanousSingleton()->getData($idHash);
289
+            if(miscellanousSingleton()->hasData($idHash)) {
290
+                return miscellanousSingleton()->getData($idHash);
291
+            }
282 292
 
283 293
             $data = DB::table($table);
284 294
             if($conditionOrCallback) {
@@ -297,7 +307,9 @@  discard block
 block discarded – undo
297 307
     public function listAllTable()
298 308
     {
299 309
         $idHash = md5("listAllTable");
300
-        if(miscellanousSingleton()->hasData($idHash)) return miscellanousSingleton()->getData($idHash);
310
+        if(miscellanousSingleton()->hasData($idHash)) {
311
+            return miscellanousSingleton()->getData($idHash);
312
+        }
301 313
         $data = DB::connection()->getDoctrineSchemaManager()->listTableNames();
302 314
         miscellanousSingleton()->setData($idHash, $data);
303 315
         return $data;
@@ -306,7 +318,9 @@  discard block
 block discarded – undo
306 318
     public function listAllColumns($table)
307 319
     {
308 320
         $idHash = md5("listAllColumns".$table);
309
-        if(miscellanousSingleton()->hasData($idHash)) return miscellanousSingleton()->getData($idHash);
321
+        if(miscellanousSingleton()->hasData($idHash)) {
322
+            return miscellanousSingleton()->getData($idHash);
323
+        }
310 324
         $data = Schema::getColumnListing($table);
311 325
         miscellanousSingleton()->setData($idHash, $data);
312 326
         return $data;
Please login to merge, or discard this patch.
Spacing   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
     }
25 25
 
26 26
     public function getRoleByName($roleName) {
27
-        return $this->find("cb_roles",['name'=>$roleName]);
27
+        return $this->find("cb_roles", ['name'=>$roleName]);
28 28
     }
29 29
 
30 30
     public function fcm() {
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
     }
41 41
 
42 42
     public function getDeveloperPath($path = null) {
43
-        $path = ($path)?"/".trim($path,"/"):null;
43
+        $path = ($path) ? "/".trim($path, "/") : null;
44 44
         return "developer/".getSetting("developer_path").$path;
45 45
     }
46 46
 
@@ -61,16 +61,16 @@  discard block
 block discarded – undo
61 61
     }
62 62
 
63 63
     public function getAdminPath() {
64
-        return getSetting("ADMIN_PATH","admin");
64
+        return getSetting("ADMIN_PATH", "admin");
65 65
     }
66 66
 
67 67
     public function getAdminUrl($path = null) {
68
-        $path = ($path)?"/".trim($path,"/"):null;
68
+        $path = ($path) ? "/".trim($path, "/") : null;
69 69
         return url($this->getAdminPath()).$path;
70 70
     }
71 71
 
72 72
     public function getAppName() {
73
-        return getSetting("APP_NAME", env("APP_NAME","CRUDBOOSTER"));
73
+        return getSetting("APP_NAME", env("APP_NAME", "CRUDBOOSTER"));
74 74
     }
75 75
 
76 76
     /**
@@ -84,16 +84,16 @@  discard block
 block discarded – undo
84 84
      */
85 85
     private function uploadFileProcess($filename, $extension, $file, $encrypt = true, $resize_width = null, $resize_height = null)
86 86
     {
87
-        if(in_array($extension,cbConfig("UPLOAD_FILE_EXTENSION_ALLOWED"))) {
87
+        if (in_array($extension, cbConfig("UPLOAD_FILE_EXTENSION_ALLOWED"))) {
88 88
             $file_path = cbConfig("UPLOAD_PATH_FORMAT");
89
-            $file_path = str_replace("{Y}",date('Y'), $file_path);
89
+            $file_path = str_replace("{Y}", date('Y'), $file_path);
90 90
             $file_path = str_replace("{m}", date('m'), $file_path);
91 91
             $file_path = str_replace("{d}", date("d"), $file_path);
92 92
 
93 93
             //Create Directory Base On Template
94 94
             Storage::makeDirectory($file_path);
95
-            Storage::put($file_path."/index.html"," ","public");
96
-            Storage::put($file_path."/.gitignore","!.gitignore","public");
95
+            Storage::put($file_path."/index.html", " ", "public");
96
+            Storage::put($file_path."/.gitignore", "!.gitignore", "public");
97 97
 
98 98
             if ($encrypt == true) {
99 99
                 $filename = md5(strRandom(5)).'.'.$extension;
@@ -101,17 +101,17 @@  discard block
 block discarded – undo
101 101
                 $filename = slug($filename, '_').'.'.$extension;
102 102
             }
103 103
 
104
-            if($resize_width || $resize_height) {
104
+            if ($resize_width || $resize_height) {
105 105
                 $this->resizeImage($file, $file_path.'/'.$filename, $resize_width, $resize_height);
106 106
                 return $file_path.'/'.$filename;
107
-            }else{
107
+            } else {
108 108
                 if (Storage::putFileAs($file_path, $file, $filename, 'public')) {
109 109
                     return $file_path.'/'.$filename;
110 110
                 } else {
111 111
                     throw new \Exception("Something went wrong, file can't upload!");
112 112
                 }
113 113
             }
114
-        }else{
114
+        } else {
115 115
             throw new \Exception("The file format is not allowed!");
116 116
         }
117 117
     }
@@ -127,16 +127,16 @@  discard block
 block discarded – undo
127 127
     {
128 128
         $fileData = base64_decode($base64_value);
129 129
         $mime_type = finfo_buffer(finfo_open(), $fileData, FILEINFO_MIME_TYPE);
130
-        if($mime_type) {
131
-            if($mime_type = explode('/', $mime_type)) {
130
+        if ($mime_type) {
131
+            if ($mime_type = explode('/', $mime_type)) {
132 132
                 $ext = $mime_type[1];
133
-                if($filename && $ext) {
133
+                if ($filename && $ext) {
134 134
                     return $this->uploadFileProcess($filename, $ext, $fileData, $encrypt, $resize_width, $resize_height);
135 135
                 }
136
-            }else {
136
+            } else {
137 137
                 throw new \Exception("Mime type not found");
138 138
             }
139
-        }else{
139
+        } else {
140 140
             throw new \Exception("Mime type not found");
141 141
         }
142 142
     }
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
             $filename = $file->getClientOriginalName();
157 157
             $ext = strtolower($file->getClientOriginalExtension());
158 158
 
159
-            if($filename && $ext) {
159
+            if ($filename && $ext) {
160 160
                 return $this->uploadFileProcess($filename, $ext, $file, $encrypt, $resize_width, $resize_height);
161 161
             }
162 162
 
@@ -191,29 +191,29 @@  discard block
 block discarded – undo
191 191
             if ($resize_width && $resize_height) {
192 192
                 $img->fit($resize_width, $resize_height);
193 193
 
194
-            } elseif ($resize_width && ! $resize_height) {
194
+            } elseif ($resize_width && !$resize_height) {
195 195
 
196
-                $img->resize($resize_width, null, function ($constraint) {
196
+                $img->resize($resize_width, null, function($constraint) {
197 197
                     $constraint->aspectRatio();
198 198
                 });
199 199
 
200
-            } elseif (! $resize_width && $resize_height) {
200
+            } elseif (!$resize_width && $resize_height) {
201 201
 
202
-                $img->resize(null, $resize_height, function ($constraint) {
202
+                $img->resize(null, $resize_height, function($constraint) {
203 203
                     $constraint->aspectRatio();
204 204
                 });
205 205
 
206 206
             } else {
207 207
 
208 208
                 if ($img->width() > cbConfig("DEFAULT_IMAGE_MAX_WIDTH_RES")) {
209
-                    $img->resize(cbConfig("DEFAULT_IMAGE_MAX_WIDTH_RES"), null, function ($constraint) {
209
+                    $img->resize(cbConfig("DEFAULT_IMAGE_MAX_WIDTH_RES"), null, function($constraint) {
210 210
                         $constraint->aspectRatio();
211 211
                     });
212 212
                 }
213 213
             }
214 214
 
215 215
             Storage::put($fullFilePath, $img, 'public');
216
-        }else{
216
+        } else {
217 217
             throw new \Exception("The file format is not allowed!");
218 218
         }
219 219
     }
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
     {
238 238
         if (is_array($id)) {
239 239
             $idHash = md5("find".$table.serialize($id));
240
-            if(miscellanousSingleton()->hasData($idHash)) return miscellanousSingleton()->getData($idHash);
240
+            if (miscellanousSingleton()->hasData($idHash)) return miscellanousSingleton()->getData($idHash);
241 241
 
242 242
             $first = DB::table($table);
243 243
             foreach ($id as $k => $v) {
@@ -245,15 +245,15 @@  discard block
 block discarded – undo
245 245
             }
246 246
 
247 247
             $data = $first->first();
248
-            miscellanousSingleton()->setData($idHash,$data);
248
+            miscellanousSingleton()->setData($idHash, $data);
249 249
             return $data;
250 250
         } else {
251 251
             $idHash = md5("find".$table.$id);
252
-            if(miscellanousSingleton()->hasData($idHash)) return miscellanousSingleton()->getData($idHash);
252
+            if (miscellanousSingleton()->hasData($idHash)) return miscellanousSingleton()->getData($idHash);
253 253
 
254 254
             $pk = $this->pk($table);
255 255
             $data = DB::table($table)->where($pk, $id)->first();
256
-            miscellanousSingleton()->setData($idHash,$data);
256
+            miscellanousSingleton()->setData($idHash, $data);
257 257
             return $data;
258 258
         }
259 259
     }
@@ -268,30 +268,30 @@  discard block
 block discarded – undo
268 268
         $data = [];
269 269
         $idHash = null;
270 270
 
271
-        if(is_array($conditionOrCallback)) {
271
+        if (is_array($conditionOrCallback)) {
272 272
             $idHash = md5("findAll".$table.serialize($conditionOrCallback));
273
-            if(miscellanousSingleton()->hasData($idHash)) return miscellanousSingleton()->getData($idHash);
273
+            if (miscellanousSingleton()->hasData($idHash)) return miscellanousSingleton()->getData($idHash);
274 274
 
275 275
             $data = DB::table($table)->where($conditionOrCallback)->get();
276 276
         } elseif (is_callable($conditionOrCallback)) {
277 277
             $idHash = "findAll".$table.spl_object_hash($conditionOrCallback);
278
-            if(miscellanousSingleton()->hasData($idHash)) return miscellanousSingleton()->getData($idHash);
278
+            if (miscellanousSingleton()->hasData($idHash)) return miscellanousSingleton()->getData($idHash);
279 279
 
280 280
             $data = DB::table($table);
281 281
             $data = call_user_func($conditionOrCallback, $data);
282 282
             $data = $data->get();
283 283
         } else {
284 284
             $idHash = md5("findAll".$table.$conditionOrCallback);
285
-            if(miscellanousSingleton()->hasData($idHash)) return miscellanousSingleton()->getData($idHash);
285
+            if (miscellanousSingleton()->hasData($idHash)) return miscellanousSingleton()->getData($idHash);
286 286
 
287 287
             $data = DB::table($table);
288
-            if($conditionOrCallback) {
288
+            if ($conditionOrCallback) {
289 289
                 $data = $data->whereRaw($conditionOrCallback);
290 290
             }
291 291
             $data = $data->get();
292 292
         }
293 293
 
294
-        if($idHash && $data) {
294
+        if ($idHash && $data) {
295 295
             miscellanousSingleton()->setData($idHash, $data);
296 296
         }
297 297
 
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
     public function listAllTable()
302 302
     {
303 303
         $idHash = md5("listAllTable");
304
-        if(miscellanousSingleton()->hasData($idHash)) return miscellanousSingleton()->getData($idHash);
304
+        if (miscellanousSingleton()->hasData($idHash)) return miscellanousSingleton()->getData($idHash);
305 305
         $data = DB::connection()->getDoctrineSchemaManager()->listTableNames();
306 306
         miscellanousSingleton()->setData($idHash, $data);
307 307
         return $data;
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
     public function listAllColumns($table)
311 311
     {
312 312
         $idHash = md5("listAllColumns".$table);
313
-        if(miscellanousSingleton()->hasData($idHash)) return miscellanousSingleton()->getData($idHash);
313
+        if (miscellanousSingleton()->hasData($idHash)) return miscellanousSingleton()->getData($idHash);
314 314
         $data = Schema::getColumnListing($table);
315 315
         miscellanousSingleton()->setData($idHash, $data);
316 316
         return $data;
@@ -378,7 +378,7 @@  discard block
 block discarded – undo
378 378
         $validator = Validator::make($input_arr, $rules, $messages);
379 379
         if ($validator->fails()) {
380 380
             $message = $validator->errors()->all();
381
-            throw new CBValidationException(implode("; ",$message));
381
+            throw new CBValidationException(implode("; ", $message));
382 382
         }
383 383
     }
384 384
 
@@ -390,7 +390,7 @@  discard block
 block discarded – undo
390 390
     public function findPrimaryKey($table)
391 391
     {
392 392
         $pk = DB::getDoctrineSchemaManager()->listTableDetails($table)->getPrimaryKey();
393
-        if(!$pk) {
393
+        if (!$pk) {
394 394
             return null;
395 395
         }
396 396
         return $pk->getColumns()[0];
@@ -439,7 +439,7 @@  discard block
 block discarded – undo
439 439
             $string_parameters_array = explode('&', $string_parameters);
440 440
             foreach ($string_parameters_array as $s) {
441 441
                 $part = explode('=', $s);
442
-                if(isset($part[0]) && isset($part[1])) {
442
+                if (isset($part[0]) && isset($part[1])) {
443 443
                     $name = htmlspecialchars(urldecode($part[0]));
444 444
                     $name = strip_tags($name);
445 445
                     $value = htmlspecialchars(urldecode($part[1]));
@@ -456,16 +456,16 @@  discard block
 block discarded – undo
456 456
 
457 457
 
458 458
     public function routeGet($prefix, $controller) {
459
-        $alias = str_replace("@"," ", $controller);
459
+        $alias = str_replace("@", " ", $controller);
460 460
         $alias = ucwords($alias);
461
-        $alias = str_replace(" ","",$alias);
461
+        $alias = str_replace(" ", "", $alias);
462 462
         Route::get($prefix, ['uses' => $controller, 'as' => $alias]);
463 463
     }
464 464
 
465 465
     public function routePost($prefix, $controller) {
466
-        $alias = str_replace("@"," ", $controller);
466
+        $alias = str_replace("@", " ", $controller);
467 467
         $alias = ucwords($alias);
468
-        $alias = str_replace(" ","",$alias);
468
+        $alias = str_replace(" ", "", $alias);
469 469
         Route::post($prefix, ['uses' => $controller, 'as' => $alias]);
470 470
     }
471 471
 
@@ -498,7 +498,7 @@  discard block
 block discarded – undo
498 498
 
499 499
         $prefix = trim($prefix, '/').'/';
500 500
 
501
-        if(substr($controller,0,1) != "\\") {
501
+        if (substr($controller, 0, 1) != "\\") {
502 502
             $controller = "\App\Http\Controllers\\".$controller;
503 503
         }
504 504
 
Please login to merge, or discard this patch.
src/helpers/CacheHelper.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -15,10 +15,10 @@  discard block
 block discarded – undo
15 15
 {
16 16
     public static function putInGroup($key, $value, $group, $duration) {
17 17
         $key = md5($key);
18
-        $exist = (Cache::get($group))?:[];
19
-        $exist[ $key ] = ['value'=>$value,'duration'=>$duration];
18
+        $exist = (Cache::get($group)) ?: [];
19
+        $exist[$key] = ['value'=>$value, 'duration'=>$duration];
20 20
 
21
-        if($duration == -1) {
21
+        if ($duration == -1) {
22 22
             Cache::forever($group, $exist);
23 23
         } else {
24 24
             Cache::put($group, $exist, $duration);
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
     public static function getItemInGroup($key, $group) {
29 29
         $groupdata = Cache::get($group);
30 30
         $key = md5($key);
31
-        if(isset($groupdata[$key])) {
31
+        if (isset($groupdata[$key])) {
32 32
             return $groupdata[$key]['value'];
33 33
         }
34 34
         return null;
@@ -38,11 +38,11 @@  discard block
 block discarded – undo
38 38
         Cache::forget($group);
39 39
     }
40 40
 
41
-    public static function forgetInGroup($key,$group) {
41
+    public static function forgetInGroup($key, $group) {
42 42
         $key = md5($key);
43 43
         $data = Cache::get($group);
44 44
         $duration = null;
45
-        if(isset($data[$key])) {
45
+        if (isset($data[$key])) {
46 46
             $item = $data[$key];
47 47
             unset($data[$key]);
48 48
         }
Please login to merge, or discard this patch.