@@ -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 | } |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | if(Schema::hasColumn($this->data['table'], $column->getField())) { |
78 | 78 | $query->addSelect($this->data['table'].'.'.$column->getField()); |
79 | 79 | } |
80 | - }else{ |
|
80 | + } else{ |
|
81 | 81 | $query->addSelect($column->getField()); |
82 | 82 | } |
83 | 83 | } |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | { |
90 | 90 | if(isset($this->data['hook_search_query'])) { |
91 | 91 | $query = call_user_func($this->data['hook_search_query'], $query); |
92 | - }else{ |
|
92 | + } else{ |
|
93 | 93 | $query->where(function ($where) use ($columns) { |
94 | 94 | /** |
95 | 95 | * @var $where Builder |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | { |
99 | 99 | if(strpos($column->getField(),".") === false) { |
100 | 100 | $field = $this->data['table'].'.'.$column->getField(); |
101 | - }else{ |
|
101 | + } else{ |
|
102 | 102 | $field = $column->getField(); |
103 | 103 | } |
104 | 104 | $where->orWhere($field, 'like', '%'.request('q').'%'); |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | if(in_array(request('order_by'),columnSingleton()->getColumnNameOnly())) { |
118 | 118 | $query->orderBy(request('order_by'), request('order_sort')); |
119 | 119 | } |
120 | - }else{ |
|
120 | + } else{ |
|
121 | 121 | $query->orderBy($this->data['table'].'.'.cb()->findPrimaryKey($this->data['table']), "desc"); |
122 | 122 | } |
123 | 123 | |
@@ -126,7 +126,9 @@ discard block |
||
126 | 126 | |
127 | 127 | public function getIndex() |
128 | 128 | { |
129 | - if(!module()->canBrowse()) return cb()->redirect(cb()->getAdminUrl(),"You do not have a privilege access to this area"); |
|
129 | + if(!module()->canBrowse()) { |
|
130 | + return cb()->redirect(cb()->getAdminUrl(),"You do not have a privilege access to this area"); |
|
131 | + } |
|
130 | 132 | |
131 | 133 | $query = $this->repository(); |
132 | 134 | $result = $query->paginate(20); |
@@ -153,7 +155,9 @@ discard block |
||
153 | 155 | |
154 | 156 | public function getAdd() |
155 | 157 | { |
156 | - if(!module()->canCreate()) return cb()->redirect(cb()->getAdminUrl(),"You do not have a privilege access to this area"); |
|
158 | + if(!module()->canCreate()) { |
|
159 | + return cb()->redirect(cb()->getAdminUrl(),"You do not have a privilege access to this area"); |
|
160 | + } |
|
157 | 161 | |
158 | 162 | $data = []; |
159 | 163 | $data['page_title'] = $this->data['page_title'].' : Add'; |
@@ -163,7 +167,9 @@ discard block |
||
163 | 167 | |
164 | 168 | public function postAddSave() |
165 | 169 | { |
166 | - if(!module()->canCreate()) return cb()->redirect(cb()->getAdminUrl(),"You do not have a privilege access to this area"); |
|
170 | + if(!module()->canCreate()) { |
|
171 | + return cb()->redirect(cb()->getAdminUrl(),"You do not have a privilege access to this area"); |
|
172 | + } |
|
167 | 173 | |
168 | 174 | try { |
169 | 175 | $this->validation(); |
@@ -204,7 +210,9 @@ discard block |
||
204 | 210 | |
205 | 211 | public function getEdit($id) |
206 | 212 | { |
207 | - if(!module()->canUpdate()) return cb()->redirect(cb()->getAdminUrl(),"You do not have a privilege access to this area"); |
|
213 | + if(!module()->canUpdate()) { |
|
214 | + return cb()->redirect(cb()->getAdminUrl(),"You do not have a privilege access to this area"); |
|
215 | + } |
|
208 | 216 | |
209 | 217 | $data = []; |
210 | 218 | $data['row'] = $this->repository()->where($this->data['table'].'.'.getPrimaryKey($this->data['table']), $id)->first(); |
@@ -215,7 +223,9 @@ discard block |
||
215 | 223 | |
216 | 224 | public function postEditSave($id) |
217 | 225 | { |
218 | - if(!module()->canUpdate()) return cb()->redirect(cb()->getAdminUrl(),"You do not have a privilege access to this area"); |
|
226 | + if(!module()->canUpdate()) { |
|
227 | + return cb()->redirect(cb()->getAdminUrl(),"You do not have a privilege access to this area"); |
|
228 | + } |
|
219 | 229 | |
220 | 230 | try { |
221 | 231 | $this->validation(); |
@@ -259,7 +269,9 @@ discard block |
||
259 | 269 | |
260 | 270 | public function getDelete($id) |
261 | 271 | { |
262 | - if(!module()->canDelete()) return cb()->redirect(cb()->getAdminUrl(),"You do not have a privilege access to this area"); |
|
272 | + if(!module()->canDelete()) { |
|
273 | + return cb()->redirect(cb()->getAdminUrl(),"You do not have a privilege access to this area"); |
|
274 | + } |
|
263 | 275 | |
264 | 276 | if(isset($this->data['hook_before_delete']) && is_callable($this->data['hook_before_delete'])) { |
265 | 277 | call_user_func($this->data['hook_before_delete'], $id); |
@@ -286,7 +298,9 @@ discard block |
||
286 | 298 | |
287 | 299 | public function getDetail($id) |
288 | 300 | { |
289 | - if(!module()->canRead()) return cb()->redirect(cb()->getAdminUrl(),"You do not have a privilege access to this area"); |
|
301 | + if(!module()->canRead()) { |
|
302 | + return cb()->redirect(cb()->getAdminUrl(),"You do not have a privilege access to this area"); |
|
303 | + } |
|
290 | 304 | |
291 | 305 | $data = []; |
292 | 306 | $data['row'] = $this->repository()->where($this->data['table'].'.'.getPrimaryKey($this->data['table']), $id)->first(); |