@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | /** @var ColumnModel $column */ |
50 | 50 | if($data_row) { |
51 | 51 | $value = (isset($data_row->{$column->getField()}))?$data_row->{ $column->getField() }:null; |
52 | - }else{ |
|
52 | + } else{ |
|
53 | 53 | $value = request($column->getName()); |
54 | 54 | |
55 | 55 | if(!$value && $column->getDefaultValue()) { |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | foreach($column->getValue() as $key=>$val) { |
140 | 140 | $data[$key] = $val; |
141 | 141 | } |
142 | - }else{ |
|
142 | + } else{ |
|
143 | 143 | $data[$column->getField()] = $column->getValue(); |
144 | 144 | } |
145 | 145 | } |
@@ -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 | } |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | if($column->getType() != "custom") { |
76 | 76 | if(strpos($column->getField(),".") === false) { |
77 | 77 | $query->addSelect($this->data['table'].'.'.$column->getField()); |
78 | - }else{ |
|
78 | + } else{ |
|
79 | 79 | $query->addSelect($column->getField()); |
80 | 80 | } |
81 | 81 | } |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | { |
88 | 88 | if(isset($this->data['hook_search_query'])) { |
89 | 89 | $query = call_user_func($this->data['hook_search_query'], $query); |
90 | - }else{ |
|
90 | + } else{ |
|
91 | 91 | $query->where(function ($where) use ($columns) { |
92 | 92 | /** |
93 | 93 | * @var $where Builder |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | { |
97 | 97 | if(strpos($column->getField(),".") === false) { |
98 | 98 | $field = $this->data['table'].'.'.$column->getField(); |
99 | - }else{ |
|
99 | + } else{ |
|
100 | 100 | $field = $column->getField(); |
101 | 101 | } |
102 | 102 | $where->orWhere($field, 'like', '%'.request('q').'%'); |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | if(in_array(request('order_by'),columnSingleton()->getColumnNameOnly())) { |
116 | 116 | $query->orderBy(request('order_by'), request('order_sort')); |
117 | 117 | } |
118 | - }else{ |
|
118 | + } else{ |
|
119 | 119 | $query->orderBy($this->data['table'].'.'.cb()->findPrimaryKey($this->data['table']), "desc"); |
120 | 120 | } |
121 | 121 | |
@@ -124,7 +124,9 @@ discard block |
||
124 | 124 | |
125 | 125 | public function getIndex() |
126 | 126 | { |
127 | - if(!module()->canBrowse()) return cb()->redirect(cb()->getAdminUrl(),"You do not have a privilege access to this area"); |
|
127 | + if(!module()->canBrowse()) { |
|
128 | + return cb()->redirect(cb()->getAdminUrl(),"You do not have a privilege access to this area"); |
|
129 | + } |
|
128 | 130 | |
129 | 131 | $query = $this->repository(); |
130 | 132 | $result = $query->paginate(20); |
@@ -151,7 +153,9 @@ discard block |
||
151 | 153 | |
152 | 154 | public function getAdd() |
153 | 155 | { |
154 | - if(!module()->canCreate()) return cb()->redirect(cb()->getAdminUrl(),"You do not have a privilege access to this area"); |
|
156 | + if(!module()->canCreate()) { |
|
157 | + return cb()->redirect(cb()->getAdminUrl(),"You do not have a privilege access to this area"); |
|
158 | + } |
|
155 | 159 | |
156 | 160 | $data = []; |
157 | 161 | $data['page_title'] = $this->data['page_title'].' : Add'; |
@@ -161,7 +165,9 @@ discard block |
||
161 | 165 | |
162 | 166 | public function postAddSave() |
163 | 167 | { |
164 | - if(!module()->canCreate()) return cb()->redirect(cb()->getAdminUrl(),"You do not have a privilege access to this area"); |
|
168 | + if(!module()->canCreate()) { |
|
169 | + return cb()->redirect(cb()->getAdminUrl(),"You do not have a privilege access to this area"); |
|
170 | + } |
|
165 | 171 | |
166 | 172 | try { |
167 | 173 | $this->validation(); |
@@ -198,7 +204,9 @@ discard block |
||
198 | 204 | |
199 | 205 | public function getEdit($id) |
200 | 206 | { |
201 | - if(!module()->canUpdate()) return cb()->redirect(cb()->getAdminUrl(),"You do not have a privilege access to this area"); |
|
207 | + if(!module()->canUpdate()) { |
|
208 | + return cb()->redirect(cb()->getAdminUrl(),"You do not have a privilege access to this area"); |
|
209 | + } |
|
202 | 210 | |
203 | 211 | $data = []; |
204 | 212 | $data['row'] = $this->repository()->where($this->data['table'].'.'.getPrimaryKey($this->data['table']), $id)->first(); |
@@ -209,7 +217,9 @@ discard block |
||
209 | 217 | |
210 | 218 | public function postEditSave($id) |
211 | 219 | { |
212 | - if(!module()->canUpdate()) return cb()->redirect(cb()->getAdminUrl(),"You do not have a privilege access to this area"); |
|
220 | + if(!module()->canUpdate()) { |
|
221 | + return cb()->redirect(cb()->getAdminUrl(),"You do not have a privilege access to this area"); |
|
222 | + } |
|
213 | 223 | |
214 | 224 | try { |
215 | 225 | $this->validation(); |
@@ -253,7 +263,9 @@ discard block |
||
253 | 263 | |
254 | 264 | public function getDelete($id) |
255 | 265 | { |
256 | - if(!module()->canDelete()) return cb()->redirect(cb()->getAdminUrl(),"You do not have a privilege access to this area"); |
|
266 | + if(!module()->canDelete()) { |
|
267 | + return cb()->redirect(cb()->getAdminUrl(),"You do not have a privilege access to this area"); |
|
268 | + } |
|
257 | 269 | |
258 | 270 | if(isset($this->data['hook_before_delete']) && is_callable($this->data['hook_before_delete'])) { |
259 | 271 | call_user_func($this->data['hook_before_delete'], $id); |
@@ -280,7 +292,9 @@ discard block |
||
280 | 292 | |
281 | 293 | public function getDetail($id) |
282 | 294 | { |
283 | - if(!module()->canRead()) return cb()->redirect(cb()->getAdminUrl(),"You do not have a privilege access to this area"); |
|
295 | + if(!module()->canRead()) { |
|
296 | + return cb()->redirect(cb()->getAdminUrl(),"You do not have a privilege access to this area"); |
|
297 | + } |
|
284 | 298 | |
285 | 299 | $data = []; |
286 | 300 | $data['row'] = $this->repository()->where($this->data['table'].'.'.getPrimaryKey($this->data['table']), $id)->first(); |