@@ -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 | } |
@@ -14,7 +14,9 @@ |
||
14 | 14 | { |
15 | 15 | public function postUploadFile() |
16 | 16 | { |
17 | - if(auth()->guest()) return redirect(cb()->getLoginUrl()); |
|
17 | + if(auth()->guest()) { |
|
18 | + return redirect(cb()->getLoginUrl()); |
|
19 | + } |
|
18 | 20 | |
19 | 21 | $file = null; |
20 | 22 | try { |
@@ -14,7 +14,9 @@ |
||
14 | 14 | { |
15 | 15 | public function postUploadImage() |
16 | 16 | { |
17 | - if(auth()->guest()) return redirect(cb()->getLoginUrl()); |
|
17 | + if(auth()->guest()) { |
|
18 | + return redirect(cb()->getLoginUrl()); |
|
19 | + } |
|
18 | 20 | |
19 | 21 | $file = null; |
20 | 22 | try { |