@@ -31,10 +31,10 @@ discard block |
||
31 | 31 | $key = $parameters[0]; |
32 | 32 | if(isset($this->data[$key])) { |
33 | 33 | return $this->data[$key]; |
34 | - }else{ |
|
34 | + } else{ |
|
35 | 35 | return null; |
36 | 36 | } |
37 | - }else{ |
|
37 | + } else{ |
|
38 | 38 | return null; |
39 | 39 | } |
40 | 40 | } |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | /** @var ColumnModel $column */ |
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 | |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | { |
87 | 87 | if(isset($this->data['hook_search_query'])) { |
88 | 88 | $query = call_user_func($this->data['hook_search_query'], $query); |
89 | - }else{ |
|
89 | + } else{ |
|
90 | 90 | $query->where(function ($where) use ($columns) { |
91 | 91 | /** |
92 | 92 | * @var $where Builder |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | { |
96 | 96 | if(strpos($column->getField(),".") === false) { |
97 | 97 | $field = $this->data['table'].'.'.$column->getField(); |
98 | - }else{ |
|
98 | + } else{ |
|
99 | 99 | $field = $column->getField(); |
100 | 100 | } |
101 | 101 | $where->orWhere($field, 'like', '%'.request('q').'%'); |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | if(in_array(request('order_by'),columnSingleton()->getColumnNameOnly())) { |
115 | 115 | $query->orderBy(request('order_by'), request('order_sort')); |
116 | 116 | } |
117 | - }else{ |
|
117 | + } else{ |
|
118 | 118 | $query->orderBy($this->data['table'].'.'.cb()->findPrimaryKey($this->data['table']), "desc"); |
119 | 119 | } |
120 | 120 | |
@@ -123,7 +123,9 @@ discard block |
||
123 | 123 | |
124 | 124 | public function getIndex() |
125 | 125 | { |
126 | - if(!module()->canBrowse()) return cb()->redirect(cb()->getAdminUrl(),"You do not have access to this area"); |
|
126 | + if(!module()->canBrowse()) { |
|
127 | + return cb()->redirect(cb()->getAdminUrl(),"You do not have access to this area"); |
|
128 | + } |
|
127 | 129 | |
128 | 130 | $query = $this->repository(); |
129 | 131 | $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 access to this area"); |
|
154 | + if(!module()->canCreate()) { |
|
155 | + return cb()->redirect(cb()->getAdminUrl(),"You do not have 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 access to this area"); |
|
166 | + if(!module()->canCreate()) { |
|
167 | + return cb()->redirect(cb()->getAdminUrl(),"You do not have 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 access to this area"); |
|
202 | + if(!module()->canUpdate()) { |
|
203 | + return cb()->redirect(cb()->getAdminUrl(),"You do not have 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 access to this area"); |
|
215 | + if(!module()->canUpdate()) { |
|
216 | + return cb()->redirect(cb()->getAdminUrl(),"You do not have 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 access to this area"); |
|
257 | + if(!module()->canDelete()) { |
|
258 | + return cb()->redirect(cb()->getAdminUrl(),"You do not have 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 access to this area"); |
|
286 | + if(!module()->canRead()) { |
|
287 | + return cb()->redirect(cb()->getAdminUrl(),"You do not have 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 postUploadFile() |
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 { |