Passed
Push — master ( b43194...ce05c1 )
by Ferry
04:20
created
src/types/select_table/filter.blade.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
     /** @var \crocodicstudio\crudbooster\types\text\TextModel $column */
3
-    $filterName = "filter_".slug($column->getFilterColumn(),"_");
3
+    $filterName = "filter_".slug($column->getFilterColumn(), "_");
4 4
     $filterValue = sanitizeXSS(request($filterName));
5 5
 ?>
6 6
 <select name="filter_{{ slug($column->getFilterColumn(),"_") }}" style="width: 100%" id="filter_{{ $column->getName()  }}" class="form-control select2">
Please login to merge, or discard this patch.
src/views/dev_layouts/modules/appearance/index.blade.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@
 block discarded – undo
57 57
                                 <label>Dashboard Controller</label>
58 58
                                 <select name="dashboard_controller" class="form-control">
59 59
                                     <option value="">** Default CB</option>
60
-                                    <?php $controllers = glob(app_path("Http/Controllers/*Controller.php"));?>
60
+                                    <?php $controllers = glob(app_path("Http/Controllers/*Controller.php")); ?>
61 61
                                     @foreach($controllers as $controller)
62 62
                                         @if(basename($controller) != "Controller.php")
63 63
                                         <option {{ getSetting("dashboard_controller")==rtrim(basename($controller),".php")?"selected":"" }} value="{{ rtrim(basename($controller),".php") }}">{{ rtrim(basename($controller),".php") }}</option>
Please login to merge, or discard this patch.
src/types/image/Hook.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
     {
24 24
         // Direct return value because its been uploaded on client side
25 25
         $ext = strtolower(pathinfo($value, PATHINFO_EXTENSION));
26
-        if(in_array($ext, cbConfig("UPLOAD_IMAGE_EXTENSION_ALLOWED"))) {
26
+        if (in_array($ext, cbConfig("UPLOAD_IMAGE_EXTENSION_ALLOWED"))) {
27 27
             return $value;
28 28
         }
29 29
     }
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
     public function detailRender($row, $column)
32 32
     {
33 33
         $column->setValue($row->{ $column->getField() });
34
-        return view("types::image.detail",[
34
+        return view("types::image.detail", [
35 35
             'row'=>$row,
36 36
             'column'=>$column
37 37
         ]);
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
     public function indexRender($row, $column)
41 41
     {
42 42
         $column->setValue($row->{ $column->getField() });
43
-        return view("types::image.index",[
43
+        return view("types::image.index", [
44 44
             'row'=>$row,
45 45
             'column'=>$column
46 46
         ]);
Please login to merge, or discard this patch.
src/types/file/Hook.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
     public function assignment($value, $column)
23 23
     {
24 24
         $ext = strtolower(pathinfo($value, PATHINFO_EXTENSION));
25
-        if(in_array($ext, cbConfig("UPLOAD_FILE_EXTENSION_ALLOWED"))) {
25
+        if (in_array($ext, cbConfig("UPLOAD_FILE_EXTENSION_ALLOWED"))) {
26 26
             return $value;
27 27
         }
28 28
     }
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
     public function detailRender($row, $column)
31 31
     {
32 32
         $column->setValue($row->{ $column->getField() });
33
-        return view("types::file.detail",[
33
+        return view("types::file.detail", [
34 34
             'row'=>$row,
35 35
             'column'=>$column
36 36
         ]);
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")?:$this->data['limit'] );
38
+        $result = $query->paginate(request("limit") ?: $this->data['limit']);
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'], $data, $id);
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")?:$this->data['limit'] );
@@ -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/routes.php 2 patches
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -67,7 +67,7 @@
 block discarded – undo
67 67
     if (Request::is(cb()->getAdminPath())) {
68 68
         if($dashboard = getSetting("dashboard_controller")) {
69 69
             cb()->routeGet("/", $dashboard."@getIndex");
70
-        }else{
70
+        } else{
71 71
             cb()->routeGet("/", "\crocodicstudio\crudbooster\controllers\AdminDashboardController@getIndex");
72 72
         }
73 73
     }
Please login to merge, or discard this patch.
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -1,61 +1,61 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 // Developer Backend Middleware
4
-Route::group(['middleware' => ['web',\crocodicstudio\crudbooster\middlewares\CBDeveloper::class],
4
+Route::group(['middleware' => ['web', \crocodicstudio\crudbooster\middlewares\CBDeveloper::class],
5 5
     'prefix'=>"developer/".getSetting('developer_path'),
6
-    'namespace' => 'crocodicstudio\crudbooster\controllers'], function () {
6
+    'namespace' => 'crocodicstudio\crudbooster\controllers'], function() {
7 7
     cb()->routeController("modules", "\crocodicstudio\crudbooster\controllers\DeveloperModulesController");
8 8
     cb()->routeController("menus", "\crocodicstudio\crudbooster\controllers\DeveloperMenusController");
9
-    cb()->routeController("roles","\crocodicstudio\crudbooster\controllers\DeveloperRolesController");
10
-    cb()->routeController("users","\crocodicstudio\crudbooster\controllers\DeveloperUsersController");
11
-    cb()->routeController("plugins","\crocodicstudio\crudbooster\controllers\DeveloperPluginStoreController");
12
-    cb()->routeController("mail","\crocodicstudio\crudbooster\controllers\DeveloperMailController");
13
-    cb()->routeController("security","\crocodicstudio\crudbooster\controllers\DeveloperSecurityController");
14
-    cb()->routeController("themes","\crocodicstudio\crudbooster\controllers\DeveloperThemesController");
15
-    cb()->routeController("appearance","\crocodicstudio\crudbooster\controllers\DeveloperAppearanceController");
16
-    cb()->routeController("miscellaneous","\crocodicstudio\crudbooster\controllers\DeveloperMiscellaneousController");
17
-    cb()->routePost("skip-tutorial","DeveloperDashboardController@postSkipTutorial");
18
-    cb()->routeGet("/","DeveloperDashboardController@getIndex");
9
+    cb()->routeController("roles", "\crocodicstudio\crudbooster\controllers\DeveloperRolesController");
10
+    cb()->routeController("users", "\crocodicstudio\crudbooster\controllers\DeveloperUsersController");
11
+    cb()->routeController("plugins", "\crocodicstudio\crudbooster\controllers\DeveloperPluginStoreController");
12
+    cb()->routeController("mail", "\crocodicstudio\crudbooster\controllers\DeveloperMailController");
13
+    cb()->routeController("security", "\crocodicstudio\crudbooster\controllers\DeveloperSecurityController");
14
+    cb()->routeController("themes", "\crocodicstudio\crudbooster\controllers\DeveloperThemesController");
15
+    cb()->routeController("appearance", "\crocodicstudio\crudbooster\controllers\DeveloperAppearanceController");
16
+    cb()->routeController("miscellaneous", "\crocodicstudio\crudbooster\controllers\DeveloperMiscellaneousController");
17
+    cb()->routePost("skip-tutorial", "DeveloperDashboardController@postSkipTutorial");
18
+    cb()->routeGet("/", "DeveloperDashboardController@getIndex");
19 19
 });
20 20
 
21 21
 // Developer Auth Middleware
22 22
 Route::group(['middleware' => ['web'],
23 23
     'prefix'=>"developer/".getSetting('developer_path'),
24
-    'namespace' => 'crocodicstudio\crudbooster\controllers'], function () {
25
-    cb()->routePost("login","AdminAuthController@postLoginDeveloper");
26
-    cb()->routeGet("login","AdminAuthController@getLoginDeveloper");
27
-    cb()->routeGet("logout","AdminAuthController@getLogoutDeveloper");
24
+    'namespace' => 'crocodicstudio\crudbooster\controllers'], function() {
25
+    cb()->routePost("login", "AdminAuthController@postLoginDeveloper");
26
+    cb()->routeGet("login", "AdminAuthController@getLoginDeveloper");
27
+    cb()->routeGet("logout", "AdminAuthController@getLogoutDeveloper");
28 28
 });
29 29
 
30 30
 // Routing without any middleware
31
-Route::group(['middleware' => ['web'], 'namespace' => '\crocodicstudio\crudbooster\controllers'], function () {
32
-    if(getSetting("AUTO_REDIRECT_TO_LOGIN")) {
33
-        cb()->routeGet("/","AdminAuthController@getRedirectToLogin");
31
+Route::group(['middleware' => ['web'], 'namespace' => '\crocodicstudio\crudbooster\controllers'], function() {
32
+    if (getSetting("AUTO_REDIRECT_TO_LOGIN")) {
33
+        cb()->routeGet("/", "AdminAuthController@getRedirectToLogin");
34 34
     }
35 35
 });
36 36
 
37 37
 // Routing without any middleware with admin prefix
38
-Route::group(['middleware' => ['web'], 'prefix' => cb()->getAdminPath(), 'namespace' => 'crocodicstudio\crudbooster\controllers'], function () {
38
+Route::group(['middleware' => ['web'], 'prefix' => cb()->getAdminPath(), 'namespace' => 'crocodicstudio\crudbooster\controllers'], function() {
39 39
     cb()->routeGet('logout', "AdminAuthController@getLogout");
40 40
 
41
-    if(!getSetting("DISABLE_LOGIN")) {
41
+    if (!getSetting("DISABLE_LOGIN")) {
42 42
         cb()->routePost('login', "AdminAuthController@postLogin");
43 43
         cb()->routeGet('login', "AdminAuthController@getLogin");
44
-        cb()->routeGet("login-verification","AdminAuthController@getLoginVerification");
45
-        cb()->routePost("submit-login-verification","AdminAuthController@postSubmitLoginVerification");
44
+        cb()->routeGet("login-verification", "AdminAuthController@getLoginVerification");
45
+        cb()->routePost("submit-login-verification", "AdminAuthController@postSubmitLoginVerification");
46 46
     }
47 47
 
48
-    if(getSetting("enable_forget")) {
49
-        cb()->routePost("forget","AdminAuthController@postForget");
48
+    if (getSetting("enable_forget")) {
49
+        cb()->routePost("forget", "AdminAuthController@postForget");
50 50
     }
51 51
 
52
-    if(getSetting("enable_register")) {
53
-        cb()->routePost("register","AdminAuthController@postRegister");
52
+    if (getSetting("enable_register")) {
53
+        cb()->routePost("register", "AdminAuthController@postRegister");
54 54
     }
55 55
 });
56 56
 
57 57
 // Routing package controllers
58
-cb()->routeGroupBackend(function () {
58
+cb()->routeGroupBackend(function() {
59 59
     cb()->routeController('profile', '\crocodicstudio\crudbooster\controllers\AdminProfileController');
60 60
 });
61 61
 
@@ -64,24 +64,24 @@  discard block
 block discarded – undo
64 64
     'middleware' => ['web', \crocodicstudio\crudbooster\middlewares\CBBackend::class],
65 65
     'prefix' => cb()->getAdminPath(),
66 66
     'namespace' => 'App\Http\Controllers',
67
-], function () {
67
+], function() {
68 68
 
69 69
     if (Request::is(cb()->getAdminPath())) {
70
-        if($dashboard = getSetting("dashboard_controller")) {
70
+        if ($dashboard = getSetting("dashboard_controller")) {
71 71
             cb()->routeGet("/", $dashboard."@getIndex");
72
-        }else{
72
+        } else {
73 73
             cb()->routeGet("/", "\crocodicstudio\crudbooster\controllers\AdminDashboardController@getIndex");
74 74
         }
75 75
     }
76 76
 
77 77
     $controllers = glob(app_path('Http/Controllers/Admin*Controller.php'));
78 78
 
79
-    foreach($controllers as $controller) {
79
+    foreach ($controllers as $controller) {
80 80
         $controllerName = basename($controller);
81
-        $controllerName = rtrim($controllerName,".php");
81
+        $controllerName = rtrim($controllerName, ".php");
82 82
         $className = '\App\Http\Controllers\\'.$controllerName;
83 83
         $controllerClass = new $className();
84
-        if(method_exists($controllerClass, 'cbInit')) {
84
+        if (method_exists($controllerClass, 'cbInit')) {
85 85
             cb()->routeController($controllerClass->getData('permalink'), $controllerName);
86 86
         }
87 87
     }
Please login to merge, or discard this patch.
src/controllers/DeveloperPluginStoreController.php 2 patches
Braces   +7 added lines, -6 removed lines patch added patch discarded remove patch
@@ -103,10 +103,10 @@  discard block
 block discarded – undo
103 103
                 rrmdir(app_path("CBPlugins/".$key));
104 104
 
105 105
                 return response()->json(['status'=>true, 'message'=>'Plugin has been uninstalled!']);
106
-            }else{
106
+            } else{
107 107
                 return response()->json(['status'=>false,'message'=>'Failed to uninstall, plugin is not found']);
108 108
             }
109
-        }else {
109
+        } else {
110 110
             return response()->json(['status'=>false,'message'=>'Failed to uninstall, plugin key is not found']);
111 111
         }
112 112
     }
@@ -118,8 +118,7 @@  discard block
 block discarded – undo
118 118
             if (( $file != '.' ) && ( $file != '..' )) {
119 119
                 if ( is_dir($src . '/' . $file) ) {
120 120
                     $this->recursiveCopy($src . '/' . $file,$dst . '/' . $file);
121
-                }
122
-                else {
121
+                } else {
123 122
                     copy($src . '/' . $file,$dst . '/' . $file);
124 123
                 }
125 124
             }
@@ -165,7 +164,9 @@  discard block
 block discarded – undo
165 164
                         fclose($temp);
166 165
 
167 166
                         // Rename
168
-                        if(file_exists(app_path("CBPlugins/".$key))) rrmdir(app_path("CBPlugins/".$key));
167
+                        if(file_exists(app_path("CBPlugins/".$key))) {
168
+                            rrmdir(app_path("CBPlugins/".$key));
169
+                        }
169 170
                         rename(app_path("CBPlugins/".$dirName), app_path("CBPlugins/".$key));
170 171
 
171 172
                         // Read Plugin JSON
@@ -192,7 +193,7 @@  discard block
 block discarded – undo
192 193
                     }
193 194
                 }
194 195
 
195
-            }else{
196
+            } else{
196 197
                 return response()->json(['status'=>false,'message'=>'Failed to install/update, plugin key is not found']);
197 198
             }
198 199
         } catch (\Exception $e) {
Please login to merge, or discard this patch.
Spacing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -31,25 +31,25 @@  discard block
 block discarded – undo
31 31
 
32 32
     public function getIndex() {
33 33
 
34
-        if(request("refresh")) {
35
-            $this->fetchPluginData(false );
36
-            return cb()->redirectBack("Plugin list has been refreshed!","success");
34
+        if (request("refresh")) {
35
+            $this->fetchPluginData(false);
36
+            return cb()->redirectBack("Plugin list has been refreshed!", "success");
37 37
         }
38 38
 
39 39
         $data = [];
40 40
         $data['result'] = $this->fetchPluginData();
41
-        return view($this->view.'.index',$data);
41
+        return view($this->view.'.index', $data);
42 42
     }
43 43
 
44 44
     public function getUninstall($key)
45 45
     {
46 46
         $pluginData = $this->fetchPluginData();
47 47
 
48
-        if(isset($pluginData[$key])) {
49
-            if(file_exists(app_path("CBPlugins/".$key))) {
48
+        if (isset($pluginData[$key])) {
49
+            if (file_exists(app_path("CBPlugins/".$key))) {
50 50
 
51
-                if(isset($pluginData['source']) && $pluginData['source'] == 'composer') {
52
-                    if(isset($pluginData['package'])) {
51
+                if (isset($pluginData['source']) && $pluginData['source'] == 'composer') {
52
+                    if (isset($pluginData['package'])) {
53 53
                         ComposerHelper::composerRemove($pluginData['package']);
54 54
                     }
55 55
                 }
@@ -57,24 +57,24 @@  discard block
 block discarded – undo
57 57
                 rrmdir(app_path("CBPlugins/".$key));
58 58
 
59 59
                 return response()->json(['status'=>true, 'message'=>'Plugin has been uninstalled!']);
60
-            }else{
61
-                return response()->json(['status'=>false,'message'=>'Failed to uninstall, plugin is not found']);
60
+            } else {
61
+                return response()->json(['status'=>false, 'message'=>'Failed to uninstall, plugin is not found']);
62 62
             }
63
-        }else {
64
-            return response()->json(['status'=>false,'message'=>'Failed to uninstall, plugin key is not found']);
63
+        } else {
64
+            return response()->json(['status'=>false, 'message'=>'Failed to uninstall, plugin key is not found']);
65 65
         }
66 66
     }
67 67
 
68
-    private function recursiveCopy($src,$dst) {
68
+    private function recursiveCopy($src, $dst) {
69 69
         $dir = opendir($src);
70 70
         @mkdir($dst);
71
-        while(false !== ( $file = readdir($dir)) ) {
72
-            if (( $file != '.' ) && ( $file != '..' )) {
73
-                if ( is_dir($src . '/' . $file) ) {
74
-                    $this->recursiveCopy($src . '/' . $file,$dst . '/' . $file);
71
+        while (false !== ($file = readdir($dir))) {
72
+            if (($file != '.') && ($file != '..')) {
73
+                if (is_dir($src.'/'.$file)) {
74
+                    $this->recursiveCopy($src.'/'.$file, $dst.'/'.$file);
75 75
                 }
76 76
                 else {
77
-                    copy($src . '/' . $file,$dst . '/' . $file);
77
+                    copy($src.'/'.$file, $dst.'/'.$file);
78 78
                 }
79 79
             }
80 80
         }
@@ -83,26 +83,26 @@  discard block
 block discarded – undo
83 83
 
84 84
     public function getInstall($key)
85 85
     {
86
-        ini_set("memory_limit","192M");
86
+        ini_set("memory_limit", "192M");
87 87
         set_time_limit(500);
88 88
 
89 89
         $pluginData = $this->fetchPluginData();
90 90
 
91 91
         try {
92
-            if(isset($pluginData[$key])) {
92
+            if (isset($pluginData[$key])) {
93 93
                 $plugin = $pluginData[$key];
94 94
 
95
-                if(isset($plugin['source']) && $plugin['source'] == "composer") {
95
+                if (isset($plugin['source']) && $plugin['source'] == "composer") {
96 96
 
97
-                    if(isset($plugin['package']) && isset($plugin['service_provider'])) {
97
+                    if (isset($plugin['package']) && isset($plugin['service_provider'])) {
98 98
                         // Make a composer
99 99
                         $output = ComposerHelper::composerRequire($plugin['package'], $plugin['service_provider']);
100 100
 
101 101
                         Artisan::call("migrate");
102 102
 
103
-                        return response()->json(['status'=>true,'message'=>$output]);
103
+                        return response()->json(['status'=>true, 'message'=>$output]);
104 104
                     } else {
105
-                        return response()->json(['status'=>true,'message'=>'Installation is failed, there is no package and or service provider']);
105
+                        return response()->json(['status'=>true, 'message'=>'Installation is failed, there is no package and or service provider']);
106 106
                     }
107 107
 
108 108
                 } else {
@@ -121,16 +121,16 @@  discard block
 block discarded – undo
121 121
                         fclose($temp);
122 122
 
123 123
                         // Rename
124
-                        if(file_exists(app_path("CBPlugins/".$key))) rrmdir(app_path("CBPlugins/".$key));
124
+                        if (file_exists(app_path("CBPlugins/".$key))) rrmdir(app_path("CBPlugins/".$key));
125 125
                         rename(app_path("CBPlugins/".$dirName), app_path("CBPlugins/".$key));
126 126
 
127 127
                         // Read Plugin JSON
128 128
                         $pluginJson = json_decode(file_get_contents(app_path("CBPlugins/".$key."/plugin.json")), true);
129 129
 
130 130
                         // Check if has asset
131
-                        if($pluginJson && $pluginJson['asset']) {
131
+                        if ($pluginJson && $pluginJson['asset']) {
132 132
                             // Check destination folder is ready
133
-                            if(file_exists(public_path("cb_asset/".$key))) {
133
+                            if (file_exists(public_path("cb_asset/".$key))) {
134 134
                                 rrmdir(public_path("cb_asset/".$key));
135 135
                             }
136 136
 
@@ -144,31 +144,31 @@  discard block
 block discarded – undo
144 144
                         //Migrate
145 145
                         Artisan::call("migrate");
146 146
 
147
-                        return response()->json(['status'=>true,'message'=>'Install / update plugin has been succesfull!']);
147
+                        return response()->json(['status'=>true, 'message'=>'Install / update plugin has been succesfull!']);
148 148
 
149 149
                     } else {
150
-                        return response()->json(['status'=>false,'message'=>"Failed to install/update, can't open the plugin archive"]);
150
+                        return response()->json(['status'=>false, 'message'=>"Failed to install/update, can't open the plugin archive"]);
151 151
                     }
152 152
                 }
153 153
 
154
-            }else{
155
-                return response()->json(['status'=>false,'message'=>'Failed to install/update, plugin key is not found']);
154
+            } else {
155
+                return response()->json(['status'=>false, 'message'=>'Failed to install/update, plugin key is not found']);
156 156
             }
157 157
         } catch (\Exception $e) {
158
-            return response()->json(['status'=>false,'message'=>'Something went wrong!']);
158
+            return response()->json(['status'=>false, 'message'=>'Something went wrong!']);
159 159
         }
160 160
     }
161 161
 
162 162
     private function fetchPluginData($cache = true)
163 163
     {
164
-        if($cache === true && $data = Cache::get("plugin_store_data")) {
164
+        if ($cache === true && $data = Cache::get("plugin_store_data")) {
165 165
             return $data;
166 166
         }
167 167
 
168 168
         $result = [];
169 169
 
170 170
         try {
171
-            $no_cache = ($cache)?0:1;
171
+            $no_cache = ($cache) ? 0 : 1;
172 172
             $opts = [
173 173
                 "http" => [
174 174
                     "method" => "GET",
@@ -181,13 +181,13 @@  discard block
 block discarded – undo
181 181
             $context = stream_context_create($opts);
182 182
             $data = file_get_contents(base64_decode("aHR0cDovL2NydWRib29zdGVyLmNvbS9hcGkvcGx1Z2luP2FjY2Vzc190b2tlbj1iVmMvWm5wWU5TWnJNVlpZT0hFNVUydHFjU1U9"), false, $context);
183 183
             
184
-            if($data) {
184
+            if ($data) {
185 185
                 $data = json_decode($data, true);
186
-                if($data['status']==true) {
186
+                if ($data['status'] == true) {
187 187
 
188
-                    foreach($data['data'] as $item) {
188
+                    foreach ($data['data'] as $item) {
189 189
                         $key = $item['key'];
190
-                        $result[ $key ] = $item;
190
+                        $result[$key] = $item;
191 191
                     }
192 192
 
193 193
                     $result = collect($result)->sortBy("name")->all();
Please login to merge, or discard this patch.
src/database/migrations/2016_08_07_152421_modify_users.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
      */
13 13
     public function up()
14 14
     {
15
-        Schema::table('users', function (Blueprint $table) {
15
+        Schema::table('users', function(Blueprint $table) {
16 16
             $table->string('photo')->nullable();
17 17
             $table->integer('cb_roles_id');
18 18
             $table->ipAddress("ip_address")->nullable();
@@ -28,8 +28,8 @@  discard block
 block discarded – undo
28 28
      */
29 29
     public function down()
30 30
     {
31
-        Schema::table('users', function (Blueprint $table) {
32
-            $table->dropColumn(["photo","cb_roles_id","ip_address","user_agent","login_at"]);
31
+        Schema::table('users', function(Blueprint $table) {
32
+            $table->dropColumn(["photo", "cb_roles_id", "ip_address", "user_agent", "login_at"]);
33 33
         });
34 34
     }
35 35
 }
Please login to merge, or discard this patch.
src/helpers/ComposerHelper.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@
 block discarded – undo
55 55
         $process->setInput("Y");
56 56
         $process->setWorkingDirectory(base_path())->run();
57 57
 
58
-        Artisan::call("vendor:publish",["--provider"=>$serviceProvider]);
58
+        Artisan::call("vendor:publish", ["--provider"=>$serviceProvider]);
59 59
 
60 60
         return $process->getOutput();
61 61
     }
Please login to merge, or discard this patch.