@@ -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(); |
@@ -196,7 +202,9 @@ discard block |
||
196 | 202 | |
197 | 203 | public function getEdit($id) |
198 | 204 | { |
199 | - if(!module()->canUpdate()) return cb()->redirect(cb()->getAdminUrl(),"You do not have a privilege access to this area"); |
|
205 | + if(!module()->canUpdate()) { |
|
206 | + return cb()->redirect(cb()->getAdminUrl(),"You do not have a privilege access to this area"); |
|
207 | + } |
|
200 | 208 | |
201 | 209 | $data = []; |
202 | 210 | $data['row'] = $this->repository()->where($this->data['table'].'.'.getPrimaryKey($this->data['table']), $id)->first(); |
@@ -207,7 +215,9 @@ discard block |
||
207 | 215 | |
208 | 216 | public function postEditSave($id) |
209 | 217 | { |
210 | - if(!module()->canUpdate()) return cb()->redirect(cb()->getAdminUrl(),"You do not have a privilege access to this area"); |
|
218 | + if(!module()->canUpdate()) { |
|
219 | + return cb()->redirect(cb()->getAdminUrl(),"You do not have a privilege access to this area"); |
|
220 | + } |
|
211 | 221 | |
212 | 222 | try { |
213 | 223 | $this->validation(); |
@@ -251,7 +261,9 @@ discard block |
||
251 | 261 | |
252 | 262 | public function getDelete($id) |
253 | 263 | { |
254 | - if(!module()->canDelete()) return cb()->redirect(cb()->getAdminUrl(),"You do not have a privilege access to this area"); |
|
264 | + if(!module()->canDelete()) { |
|
265 | + return cb()->redirect(cb()->getAdminUrl(),"You do not have a privilege access to this area"); |
|
266 | + } |
|
255 | 267 | |
256 | 268 | if(isset($this->data['hook_before_delete']) && is_callable($this->data['hook_before_delete'])) { |
257 | 269 | call_user_func($this->data['hook_before_delete'], $id); |
@@ -278,7 +290,9 @@ discard block |
||
278 | 290 | |
279 | 291 | public function getDetail($id) |
280 | 292 | { |
281 | - if(!module()->canRead()) return cb()->redirect(cb()->getAdminUrl(),"You do not have a privilege access to this area"); |
|
293 | + if(!module()->canRead()) { |
|
294 | + return cb()->redirect(cb()->getAdminUrl(),"You do not have a privilege access to this area"); |
|
295 | + } |
|
282 | 296 | |
283 | 297 | $data = []; |
284 | 298 | $data['row'] = $this->repository()->where($this->data['table'].'.'.getPrimaryKey($this->data['table']), $id)->first(); |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | /** @var ColumnModel $column */ |
50 | 50 | if($data_row) { |
51 | 51 | $value = $data_row->{ $column->getField() }; |
52 | - }else{ |
|
52 | + } else{ |
|
53 | 53 | $value = request($column->getName()); |
54 | 54 | |
55 | 55 | if(!$value && $column->getDefaultValue()) { |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | foreach($column->getValue() as $key=>$val) { |
139 | 139 | $data[$key] = $val; |
140 | 140 | } |
141 | - }else{ |
|
141 | + } else{ |
|
142 | 142 | $data[$column->getField()] = $column->getValue(); |
143 | 143 | } |
144 | 144 | } |