@@ -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 | } |
@@ -36,7 +36,7 @@ |
||
| 36 | 36 | $data = DB::table($table); |
| 37 | 37 | if($SQLCondition && is_callable($SQLCondition)) { |
| 38 | 38 | $data = call_user_func($SQLCondition, $data); |
| 39 | - }elseif ($SQLCondition && is_string($SQLCondition)) { |
|
| 39 | + } elseif ($SQLCondition && is_string($SQLCondition)) { |
|
| 40 | 40 | $data->whereRaw($SQLCondition); |
| 41 | 41 | } |
| 42 | 42 | $data = $data->get(); |
@@ -36,7 +36,7 @@ |
||
| 36 | 36 | if($column->getOptionsFromTable()) { |
| 37 | 37 | $option = $column->getOptionsFromTable(); |
| 38 | 38 | return $row->{ $option['table'].'_'.$option['display_field'] }; |
| 39 | - }else{ |
|
| 39 | + } else{ |
|
| 40 | 40 | $option = $column->getOptions(); |
| 41 | 41 | $key = $row->{ $column->getField() }; |
| 42 | 42 | return @$option[ $key ]; |
@@ -36,7 +36,7 @@ |
||
| 36 | 36 | $data = DB::table($table); |
| 37 | 37 | if($SQLCondition && is_callable($SQLCondition)) { |
| 38 | 38 | $data = call_user_func($SQLCondition, $data); |
| 39 | - }elseif ($SQLCondition && is_string($SQLCondition)) { |
|
| 39 | + } elseif ($SQLCondition && is_string($SQLCondition)) { |
|
| 40 | 40 | $data->whereRaw($SQLCondition); |
| 41 | 41 | } |
| 42 | 42 | $data = $data->get(); |
@@ -36,7 +36,7 @@ |
||
| 36 | 36 | $data = DB::table($table); |
| 37 | 37 | if($SQLCondition && is_callable($SQLCondition)) { |
| 38 | 38 | $data = call_user_func($SQLCondition, $data); |
| 39 | - }elseif ($SQLCondition && is_string($SQLCondition)) { |
|
| 39 | + } elseif ($SQLCondition && is_string($SQLCondition)) { |
|
| 40 | 40 | $data->whereRaw($SQLCondition); |
| 41 | 41 | } |
| 42 | 42 | $data = $data->get(); |
@@ -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 | } |
@@ -28,8 +28,11 @@ |
||
| 28 | 28 | { |
| 29 | 29 | $user = $this->user(); |
| 30 | 30 | $role = cb()->find("cb_roles", $user->cb_roles_id); |
| 31 | - if($role) return $role->name; |
|
| 32 | - else return null; |
|
| 31 | + if($role) { |
|
| 32 | + return $role->name; |
|
| 33 | + } else { |
|
| 34 | + return null; |
|
| 35 | + } |
|
| 33 | 36 | } |
| 34 | 37 | |
| 35 | 38 | public function roleId() |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | $model->setIcon($menu->icon); |
| 28 | 28 | $model->setName($menu->name); |
| 29 | 29 | $model->setBasepath(basename($model->getUrl())); |
| 30 | - }elseif ($menu->type == "module") { |
|
| 30 | + } elseif ($menu->type == "module") { |
|
| 31 | 31 | $module = cb()->find("cb_modules", $menu->cb_modules_id); |
| 32 | 32 | $className = '\App\Http\Controllers\\'.$module->controller; |
| 33 | 33 | $controllerClass = new $className(); |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | $model->setIcon($module->icon); |
| 37 | 37 | $model->setName($module->name); |
| 38 | 38 | $model->setBasepath(config('crudbooster.ADMIN_PATH').'/'.basename($model->getUrl())); |
| 39 | - }elseif ($menu->type == "path") { |
|
| 39 | + } elseif ($menu->type == "path") { |
|
| 40 | 40 | $model->setUrl(cb()->getAdminUrl($menu->path)); |
| 41 | 41 | $model->setIcon($menu->icon); |
| 42 | 42 | $model->setName($menu->name); |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | |
| 46 | 46 | if(request()->is($model->getBasepath()."*")) { |
| 47 | 47 | $model->setIsActive(true); |
| 48 | - }else{ |
|
| 48 | + } else{ |
|
| 49 | 49 | $model->setIsActive(false); |
| 50 | 50 | } |
| 51 | 51 | |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | $menus = DB::table("cb_menus"); |
| 57 | 57 | if($parent_id) { |
| 58 | 58 | $menus->where("parent_cb_menus_id",$parent_id); |
| 59 | - }else{ |
|
| 59 | + } else{ |
|
| 60 | 60 | $menus->whereNull("parent_cb_menus_id"); |
| 61 | 61 | } |
| 62 | 62 | return $menus->orderBy("sort_number","asc")->get(); |
@@ -84,26 +84,36 @@ discard block |
||
| 84 | 84 | $menus_active = false; |
| 85 | 85 | foreach($menus as $menu) { |
| 86 | 86 | |
| 87 | - if($withPrivilege && !$this->checkPrivilege($roles_id, $menu)) continue; |
|
| 87 | + if($withPrivilege && !$this->checkPrivilege($roles_id, $menu)) { |
|
| 88 | + continue; |
|
| 89 | + } |
|
| 88 | 90 | |
| 89 | 91 | $sidebarModel = $this->assignToModel($menu); |
| 90 | - if($sidebarModel->getisActive()) $menus_active = true; |
|
| 92 | + if($sidebarModel->getisActive()) { |
|
| 93 | + $menus_active = true; |
|
| 94 | + } |
|
| 91 | 95 | if($menus2 = $this->loadData($menu->id)) { |
| 92 | 96 | $sub1 = []; |
| 93 | 97 | $menus2_active = false; |
| 94 | 98 | foreach ($menus2 as $menu2) { |
| 95 | 99 | |
| 96 | - if($withPrivilege && !$this->checkPrivilege($roles_id, $menu2)) continue; |
|
| 100 | + if($withPrivilege && !$this->checkPrivilege($roles_id, $menu2)) { |
|
| 101 | + continue; |
|
| 102 | + } |
|
| 97 | 103 | |
| 98 | 104 | $sidebarModel2 = $this->assignToModel($menu2); |
| 99 | - if($sidebarModel2->getisActive()) $menus2_active = true; |
|
| 105 | + if($sidebarModel2->getisActive()) { |
|
| 106 | + $menus2_active = true; |
|
| 107 | + } |
|
| 100 | 108 | |
| 101 | 109 | if($menus3 = $this->loadData($menu2->id)) { |
| 102 | 110 | $sub2 = []; |
| 103 | 111 | $menus3_active = false; |
| 104 | 112 | foreach ($menus3 as $menu3) { |
| 105 | 113 | |
| 106 | - if($withPrivilege && !$this->checkPrivilege($roles_id, $menu3)) continue; |
|
| 114 | + if($withPrivilege && !$this->checkPrivilege($roles_id, $menu3)) { |
|
| 115 | + continue; |
|
| 116 | + } |
|
| 107 | 117 | |
| 108 | 118 | $sidebarModel3 = $this->assignToModel($menu3); |
| 109 | 119 | |
@@ -30,10 +30,10 @@ discard block |
||
| 30 | 30 | $key = $parameters[0]; |
| 31 | 31 | if(isset($this->data[$key])) { |
| 32 | 32 | return $this->data[$key]; |
| 33 | - }else{ |
|
| 33 | + } else{ |
|
| 34 | 34 | return null; |
| 35 | 35 | } |
| 36 | - }else{ |
|
| 36 | + } else{ |
|
| 37 | 37 | return null; |
| 38 | 38 | } |
| 39 | 39 | } |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | /** @var ColumnModel $column */ |
| 75 | 75 | if(strpos($column->getField(),".") === false) { |
| 76 | 76 | $query->addSelect($this->data['table'].'.'.$column->getField()); |
| 77 | - }else{ |
|
| 77 | + } else{ |
|
| 78 | 78 | $query->addSelect($column->getField()); |
| 79 | 79 | } |
| 80 | 80 | |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | { |
| 86 | 86 | if(isset($this->data['hook_search_query'])) { |
| 87 | 87 | $query = call_user_func($this->data['hook_search_query'], $query); |
| 88 | - }else{ |
|
| 88 | + } else{ |
|
| 89 | 89 | $query->where(function ($where) use ($columns) { |
| 90 | 90 | /** |
| 91 | 91 | * @var $where Builder |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | { |
| 95 | 95 | if(strpos($column->getField(),".") === false) { |
| 96 | 96 | $field = $this->data['table'].'.'.$column->getField(); |
| 97 | - }else{ |
|
| 97 | + } else{ |
|
| 98 | 98 | $field = $column->getField(); |
| 99 | 99 | } |
| 100 | 100 | $where->orWhere($field, 'like', '%'.request('q').'%'); |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | if(in_array(request('order_by'),columnSingleton()->getColumnNameOnly())) { |
| 114 | 114 | $query->orderBy(request('order_by'), request('order_sort')); |
| 115 | 115 | } |
| 116 | - }else{ |
|
| 116 | + } else{ |
|
| 117 | 117 | $query->orderBy($this->data['table'].'.'.cb()->findPrimaryKey($this->data['table']), "desc"); |
| 118 | 118 | } |
| 119 | 119 | |
@@ -122,7 +122,9 @@ discard block |
||
| 122 | 122 | |
| 123 | 123 | public function getIndex() |
| 124 | 124 | { |
| 125 | - if(!module()->canBrowse()) return cb()->redirect(cb()->getAdminUrl(),"You do not have a privilege access to this area"); |
|
| 125 | + if(!module()->canBrowse()) { |
|
| 126 | + return cb()->redirect(cb()->getAdminUrl(),"You do not have a privilege access to this area"); |
|
| 127 | + } |
|
| 126 | 128 | |
| 127 | 129 | $query = $this->repository(); |
| 128 | 130 | $result = $query->paginate(20); |
@@ -149,7 +151,9 @@ discard block |
||
| 149 | 151 | |
| 150 | 152 | public function getAdd() |
| 151 | 153 | { |
| 152 | - if(!module()->canCreate()) return cb()->redirect(cb()->getAdminUrl(),"You do not have a privilege access to this area"); |
|
| 154 | + if(!module()->canCreate()) { |
|
| 155 | + return cb()->redirect(cb()->getAdminUrl(),"You do not have a privilege access to this area"); |
|
| 156 | + } |
|
| 153 | 157 | |
| 154 | 158 | $data = []; |
| 155 | 159 | $data['page_title'] = $this->data['page_title'].' : Add'; |
@@ -159,7 +163,9 @@ discard block |
||
| 159 | 163 | |
| 160 | 164 | public function postAddSave() |
| 161 | 165 | { |
| 162 | - if(!module()->canCreate()) return cb()->redirect(cb()->getAdminUrl(),"You do not have a privilege access to this area"); |
|
| 166 | + if(!module()->canCreate()) { |
|
| 167 | + return cb()->redirect(cb()->getAdminUrl(),"You do not have a privilege access to this area"); |
|
| 168 | + } |
|
| 163 | 169 | |
| 164 | 170 | try { |
| 165 | 171 | $this->validation(); |
@@ -193,7 +199,9 @@ discard block |
||
| 193 | 199 | |
| 194 | 200 | public function getEdit($id) |
| 195 | 201 | { |
| 196 | - if(!module()->canUpdate()) return cb()->redirect(cb()->getAdminUrl(),"You do not have a privilege access to this area"); |
|
| 202 | + if(!module()->canUpdate()) { |
|
| 203 | + return cb()->redirect(cb()->getAdminUrl(),"You do not have a privilege access to this area"); |
|
| 204 | + } |
|
| 197 | 205 | |
| 198 | 206 | $data = []; |
| 199 | 207 | $data['row'] = $this->repository()->where($this->data['table'].'.'.getPrimaryKey($this->data['table']), $id)->first(); |
@@ -204,7 +212,9 @@ discard block |
||
| 204 | 212 | |
| 205 | 213 | public function postEditSave($id) |
| 206 | 214 | { |
| 207 | - if(!module()->canUpdate()) return cb()->redirect(cb()->getAdminUrl(),"You do not have a privilege access to this area"); |
|
| 215 | + if(!module()->canUpdate()) { |
|
| 216 | + return cb()->redirect(cb()->getAdminUrl(),"You do not have a privilege access to this area"); |
|
| 217 | + } |
|
| 208 | 218 | |
| 209 | 219 | try { |
| 210 | 220 | $this->validation(); |
@@ -244,7 +254,9 @@ discard block |
||
| 244 | 254 | |
| 245 | 255 | public function getDelete($id) |
| 246 | 256 | { |
| 247 | - if(!module()->canDelete()) return cb()->redirect(cb()->getAdminUrl(),"You do not have a privilege access to this area"); |
|
| 257 | + if(!module()->canDelete()) { |
|
| 258 | + return cb()->redirect(cb()->getAdminUrl(),"You do not have a privilege access to this area"); |
|
| 259 | + } |
|
| 248 | 260 | |
| 249 | 261 | if(isset($this->data['hook_before_delete']) && is_callable($this->data['hook_before_delete'])) { |
| 250 | 262 | call_user_func($this->data['hook_before_delete'], $id); |
@@ -271,7 +283,9 @@ discard block |
||
| 271 | 283 | |
| 272 | 284 | public function getDetail($id) |
| 273 | 285 | { |
| 274 | - if(!module()->canRead()) return cb()->redirect(cb()->getAdminUrl(),"You do not have a privilege access to this area"); |
|
| 286 | + if(!module()->canRead()) { |
|
| 287 | + return cb()->redirect(cb()->getAdminUrl(),"You do not have a privilege access to this area"); |
|
| 288 | + } |
|
| 275 | 289 | |
| 276 | 290 | $data = []; |
| 277 | 291 | $data['row'] = $this->repository()->where($this->data['table'].'.'.getPrimaryKey($this->data['table']), $id)->first(); |
@@ -281,7 +295,9 @@ discard block |
||
| 281 | 295 | |
| 282 | 296 | public function postUploadImage() |
| 283 | 297 | { |
| 284 | - if(auth()->guest()) return redirect(cb()->getLoginUrl()); |
|
| 298 | + if(auth()->guest()) { |
|
| 299 | + return redirect(cb()->getLoginUrl()); |
|
| 300 | + } |
|
| 285 | 301 | |
| 286 | 302 | $file = null; |
| 287 | 303 | try { |
@@ -308,7 +324,9 @@ discard block |
||
| 308 | 324 | |
| 309 | 325 | public function postUploadFile() |
| 310 | 326 | { |
| 311 | - if(auth()->guest()) return redirect(cb()->getLoginUrl()); |
|
| 327 | + if(auth()->guest()) { |
|
| 328 | + return redirect(cb()->getLoginUrl()); |
|
| 329 | + } |
|
| 312 | 330 | |
| 313 | 331 | $file = null; |
| 314 | 332 | try { |