@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | $model->setIcon($menu->icon); |
| 29 | 29 | $model->setName($menu->name); |
| 30 | 30 | $model->setBasepath(basename($model->getUrl())); |
| 31 | - }elseif ($menu->type == "module") { |
|
| 31 | + } elseif ($menu->type == "module") { |
|
| 32 | 32 | $module = cb()->find("cb_modules", $menu->cb_modules_id); |
| 33 | 33 | $className = '\App\Http\Controllers\\'.$module->controller; |
| 34 | 34 | $controllerClass = new $className(); |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | $model->setIcon($module->icon); |
| 39 | 39 | $model->setName($module->name); |
| 40 | 40 | $model->setBasepath(config('crudbooster.ADMIN_PATH').'/'.basename($model->getUrl())); |
| 41 | - }elseif ($menu->type == "path") { |
|
| 41 | + } elseif ($menu->type == "path") { |
|
| 42 | 42 | $model->setUrl(cb()->getAdminUrl($menu->path)); |
| 43 | 43 | $model->setPermalink($menu->path); |
| 44 | 44 | $model->setIcon($menu->icon); |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | |
| 49 | 49 | if(request()->is($model->getBasepath()."*")) { |
| 50 | 50 | $model->setIsActive(true); |
| 51 | - }else{ |
|
| 51 | + } else{ |
|
| 52 | 52 | $model->setIsActive(false); |
| 53 | 53 | } |
| 54 | 54 | |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | $menus = DB::table("cb_menus"); |
| 60 | 60 | if($parent_id) { |
| 61 | 61 | $menus->where("parent_cb_menus_id",$parent_id); |
| 62 | - }else{ |
|
| 62 | + } else{ |
|
| 63 | 63 | $menus->whereNull("parent_cb_menus_id"); |
| 64 | 64 | } |
| 65 | 65 | return $menus->orderBy("sort_number","asc")->get(); |
@@ -83,20 +83,26 @@ discard block |
||
| 83 | 83 | public function all($withPrivilege = true) { |
| 84 | 84 | $roles_id = ($withPrivilege)?cb()->session()->roleId():null; |
| 85 | 85 | $idHash = "menuUser".$roles_id.auth()->id(); |
| 86 | - if($menu = CacheHelper::getItemInGroup($idHash,"sidebar_menu")) return $menu; |
|
| 86 | + if($menu = CacheHelper::getItemInGroup($idHash,"sidebar_menu")) { |
|
| 87 | + return $menu; |
|
| 88 | + } |
|
| 87 | 89 | |
| 88 | 90 | $menus = $this->loadData(); |
| 89 | 91 | $result = []; |
| 90 | 92 | foreach($menus as $menu) { |
| 91 | 93 | |
| 92 | - if($withPrivilege && !$this->checkPrivilege($roles_id, $menu)) continue; |
|
| 94 | + if($withPrivilege && !$this->checkPrivilege($roles_id, $menu)) { |
|
| 95 | + continue; |
|
| 96 | + } |
|
| 93 | 97 | |
| 94 | 98 | $sidebarModel = $this->assignToModel($menu); |
| 95 | 99 | if($menus2 = $this->loadData($menu->id)) { |
| 96 | 100 | $sub1 = []; |
| 97 | 101 | foreach ($menus2 as $menu2) { |
| 98 | 102 | |
| 99 | - if($withPrivilege && !$this->checkPrivilege($roles_id, $menu2)) continue; |
|
| 103 | + if($withPrivilege && !$this->checkPrivilege($roles_id, $menu2)) { |
|
| 104 | + continue; |
|
| 105 | + } |
|
| 100 | 106 | |
| 101 | 107 | $sidebarModel2 = $this->assignToModel($menu2); |
| 102 | 108 | |
@@ -104,7 +110,9 @@ discard block |
||
| 104 | 110 | $sub2 = []; |
| 105 | 111 | foreach ($menus3 as $menu3) { |
| 106 | 112 | |
| 107 | - if($withPrivilege && !$this->checkPrivilege($roles_id, $menu3)) continue; |
|
| 113 | + if($withPrivilege && !$this->checkPrivilege($roles_id, $menu3)) { |
|
| 114 | + continue; |
|
| 115 | + } |
|
| 108 | 116 | |
| 109 | 117 | $sidebarModel3 = $this->assignToModel($menu3); |
| 110 | 118 | |
@@ -22,7 +22,7 @@ |
||
| 22 | 22 | { |
| 23 | 23 | if($column->getFormat()) { |
| 24 | 24 | return date($column->getFormat(), strtotime($row->{$column->getField()})); |
| 25 | - }else{ |
|
| 25 | + } else{ |
|
| 26 | 26 | return $row->{$column->getField()}; |
| 27 | 27 | } |
| 28 | 28 | } |
@@ -32,7 +32,9 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | } |
@@ -67,7 +67,7 @@ |
||
| 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 | } |
@@ -103,10 +103,10 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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) { |