@@ -27,14 +27,14 @@ discard block |
||
27 | 27 | |
28 | 28 | public function __call($method, $parameters) |
29 | 29 | { |
30 | - if($method == "getData") { |
|
30 | + if ($method == "getData") { |
|
31 | 31 | $key = $parameters[0]; |
32 | - if(isset($this->data[$key])) { |
|
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 | } |
@@ -49,19 +49,19 @@ discard block |
||
49 | 49 | |
50 | 50 | $query->addSelect($this->data['table'].'.'.cb()->pk($this->data['table']).' as primary_key'); |
51 | 51 | |
52 | - if(isset($this->data['hook_query_index']) && is_callable($this->data['hook_query_index'])) |
|
52 | + if (isset($this->data['hook_query_index']) && is_callable($this->data['hook_query_index'])) |
|
53 | 53 | { |
54 | 54 | $query = call_user_func($this->data['hook_query_index'], $query); |
55 | 55 | } |
56 | 56 | |
57 | - $softDelete = isset($this->data['disable_soft_delete'])?$this->data['disable_soft_delete']:true; |
|
58 | - if($softDelete === true && Schema::hasColumn($this->data['table'],'deleted_at')) { |
|
57 | + $softDelete = isset($this->data['disable_soft_delete']) ? $this->data['disable_soft_delete'] : true; |
|
58 | + if ($softDelete === true && Schema::hasColumn($this->data['table'], 'deleted_at')) { |
|
59 | 59 | $query->whereNull($this->data['table'].'.deleted_at'); |
60 | 60 | } |
61 | 61 | |
62 | 62 | |
63 | - if(isset($joins)) { |
|
64 | - foreach($joins as $join) |
|
63 | + if (isset($joins)) { |
|
64 | + foreach ($joins as $join) |
|
65 | 65 | { |
66 | 66 | $query->join($join['target_table'], |
67 | 67 | $join['target_table_primary'], |
@@ -71,27 +71,27 @@ discard block |
||
71 | 71 | } |
72 | 72 | } |
73 | 73 | |
74 | - foreach($columns as $column) { |
|
74 | + foreach ($columns as $column) { |
|
75 | 75 | /** @var ColumnModel $column */ |
76 | - if(strpos($column->getField(),".") === false) { |
|
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 | |
82 | 82 | $query = getTypeHook($column->getType())->query($query, $column); |
83 | 83 | } |
84 | 84 | |
85 | - if(request()->has('q')) |
|
85 | + if (request()->has('q')) |
|
86 | 86 | { |
87 | - if(isset($this->data['hook_search_query'])) { |
|
87 | + if (isset($this->data['hook_search_query'])) { |
|
88 | 88 | $query = call_user_func($this->data['hook_search_query'], $query); |
89 | - }else{ |
|
90 | - $query->where(function ($where) use ($columns) { |
|
89 | + } else { |
|
90 | + $query->where(function($where) use ($columns) { |
|
91 | 91 | /** |
92 | 92 | * @var $where Builder |
93 | 93 | */ |
94 | - foreach($columns as $column) |
|
94 | + foreach ($columns as $column) |
|
95 | 95 | { |
96 | 96 | $where->orWhere($column['name'], 'like', '%'.request('q').'%'); |
97 | 97 | } |
@@ -99,18 +99,18 @@ discard block |
||
99 | 99 | } |
100 | 100 | } |
101 | 101 | |
102 | - if(isset($this->data['hook_query_index']) && is_callable($this->data['hook_query_index'])) { |
|
102 | + if (isset($this->data['hook_query_index']) && is_callable($this->data['hook_query_index'])) { |
|
103 | 103 | $query = call_user_func($this->data['hook_query_index'], $query); |
104 | 104 | } |
105 | 105 | |
106 | 106 | |
107 | - if(request()->has(['order_by','order_sort'])) |
|
107 | + if (request()->has(['order_by', 'order_sort'])) |
|
108 | 108 | { |
109 | - if(in_array(request('order_by'),columnSingleton()->getColumnNameOnly())) { |
|
109 | + if (in_array(request('order_by'), columnSingleton()->getColumnNameOnly())) { |
|
110 | 110 | $query->orderBy(request('order_by'), request('order_sort')); |
111 | 111 | } |
112 | - }else{ |
|
113 | - if(isset($this->data['order_by'])) { |
|
112 | + } else { |
|
113 | + if (isset($this->data['order_by'])) { |
|
114 | 114 | $query->orderBy($this->data['order_by'][0], $this->data['order_by'][1]); |
115 | 115 | } |
116 | 116 | } |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | |
121 | 121 | public function getIndex() |
122 | 122 | { |
123 | - if(!module()->canBrowse()) return cb()->redirect(cb()->getAdminUrl(),"You do not have access to this area"); |
|
123 | + if (!module()->canBrowse()) return cb()->redirect(cb()->getAdminUrl(), "You do not have access to this area"); |
|
124 | 124 | |
125 | 125 | $query = $this->repository(); |
126 | 126 | $result = $query->paginate(20); |
@@ -134,51 +134,51 @@ discard block |
||
134 | 134 | */ |
135 | 135 | private function validation() |
136 | 136 | { |
137 | - if(isset($this->data['validation'])) { |
|
137 | + if (isset($this->data['validation'])) { |
|
138 | 138 | $validator = Validator::make(request()->all(), @$this->data['validation'], @$this->data['validation_messages']); |
139 | 139 | if ($validator->fails()) { |
140 | 140 | $message = $validator->messages(); |
141 | 141 | $message_all = $message->all(); |
142 | - throw new CBValidationException(implode(', ',$message_all)); |
|
142 | + throw new CBValidationException(implode(', ', $message_all)); |
|
143 | 143 | } |
144 | 144 | } |
145 | 145 | } |
146 | 146 | |
147 | 147 | public function getAdd() |
148 | 148 | { |
149 | - if(!module()->canCreate()) return cb()->redirect(cb()->getAdminUrl(),"You do not have access to this area"); |
|
149 | + if (!module()->canCreate()) return cb()->redirect(cb()->getAdminUrl(), "You do not have access to this area"); |
|
150 | 150 | |
151 | 151 | $data = []; |
152 | 152 | $data['page_title'] = $this->data['page_title'].' : Add'; |
153 | 153 | $data['action_url'] = module()->addSaveURL(); |
154 | - return view('crudbooster::module.form.form',$data); |
|
154 | + return view('crudbooster::module.form.form', $data); |
|
155 | 155 | } |
156 | 156 | |
157 | 157 | public function postAddSave() |
158 | 158 | { |
159 | - if(!module()->canCreate()) return cb()->redirect(cb()->getAdminUrl(),"You do not have access to this area"); |
|
159 | + if (!module()->canCreate()) return cb()->redirect(cb()->getAdminUrl(), "You do not have access to this area"); |
|
160 | 160 | |
161 | 161 | try { |
162 | 162 | $this->validation(); |
163 | 163 | columnSingleton()->valueAssignment(); |
164 | 164 | $data = columnSingleton()->getAssignmentData(); |
165 | 165 | |
166 | - if(Schema::hasColumn($this->data['table'], 'created_at')) { |
|
166 | + if (Schema::hasColumn($this->data['table'], 'created_at')) { |
|
167 | 167 | $data['created_at'] = date('Y-m-d H:i:s'); |
168 | 168 | } |
169 | 169 | |
170 | 170 | $id = DB::table($this->data['table'])->insertGetId($data); |
171 | 171 | |
172 | - if(isset($this->data['hook_after_insert']) && is_callable($this->data['hook_after_insert'])) { |
|
172 | + if (isset($this->data['hook_after_insert']) && is_callable($this->data['hook_after_insert'])) { |
|
173 | 173 | call_user_func($this->data['hook_after_insert'], $id); |
174 | 174 | } |
175 | 175 | |
176 | 176 | } catch (CBValidationException $e) { |
177 | 177 | Log::debug($e); |
178 | - return cb()->redirectBack($e->getMessage(),'info'); |
|
178 | + return cb()->redirectBack($e->getMessage(), 'info'); |
|
179 | 179 | } catch (\Exception $e) { |
180 | 180 | Log::error($e); |
181 | - return cb()->redirectBack($e->getMessage(),'warning'); |
|
181 | + return cb()->redirectBack($e->getMessage(), 'warning'); |
|
182 | 182 | } |
183 | 183 | |
184 | 184 | if (request('submit') == trans('crudbooster.button_save_more')) { |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | |
191 | 191 | public function getEdit($id) |
192 | 192 | { |
193 | - if(!module()->canUpdate()) return cb()->redirect(cb()->getAdminUrl(),"You do not have access to this area"); |
|
193 | + if (!module()->canUpdate()) return cb()->redirect(cb()->getAdminUrl(), "You do not have access to this area"); |
|
194 | 194 | |
195 | 195 | $data = []; |
196 | 196 | $data['row'] = $this->repository()->where($this->data['table'].'.'.getPrimaryKey($this->data['table']), $id)->first(); |
@@ -201,17 +201,17 @@ discard block |
||
201 | 201 | |
202 | 202 | public function postEditSave($id) |
203 | 203 | { |
204 | - if(!module()->canUpdate()) return cb()->redirect(cb()->getAdminUrl(),"You do not have access to this area"); |
|
204 | + if (!module()->canUpdate()) return cb()->redirect(cb()->getAdminUrl(), "You do not have access to this area"); |
|
205 | 205 | |
206 | 206 | try { |
207 | 207 | $this->validation(); |
208 | 208 | columnSingleton()->valueAssignment(); |
209 | 209 | $data = columnSingleton()->getAssignmentData(); |
210 | - if(Schema::hasColumn($this->data['table'], 'updated_at')) { |
|
210 | + if (Schema::hasColumn($this->data['table'], 'updated_at')) { |
|
211 | 211 | $data['updated_at'] = date('Y-m-d H:i:s'); |
212 | 212 | } |
213 | 213 | |
214 | - if(isset($this->data['hook_before_update']) && is_callable($this->data['hook_before_update'])) { |
|
214 | + if (isset($this->data['hook_before_update']) && is_callable($this->data['hook_before_update'])) { |
|
215 | 215 | call_user_func($this->data['hook_before_update'], $id); |
216 | 216 | } |
217 | 217 | |
@@ -219,16 +219,16 @@ discard block |
||
219 | 219 | ->where(cb()->pk($this->data['table']), $id) |
220 | 220 | ->update($data); |
221 | 221 | |
222 | - if(isset($this->data['hook_after_update']) && is_callable($this->data['hook_after_update'])) { |
|
222 | + if (isset($this->data['hook_after_update']) && is_callable($this->data['hook_after_update'])) { |
|
223 | 223 | call_user_func($this->data['hook_after_update'], $id); |
224 | 224 | } |
225 | 225 | |
226 | 226 | } catch (CBValidationException $e) { |
227 | 227 | Log::debug($e); |
228 | - return cb()->redirectBack($e->getMessage(),'info'); |
|
228 | + return cb()->redirectBack($e->getMessage(), 'info'); |
|
229 | 229 | } catch (\Exception $e) { |
230 | 230 | Log::error($e); |
231 | - return cb()->redirectBack($e->getMessage(),'warning'); |
|
231 | + return cb()->redirectBack($e->getMessage(), 'warning'); |
|
232 | 232 | } |
233 | 233 | |
234 | 234 | |
@@ -241,15 +241,15 @@ discard block |
||
241 | 241 | |
242 | 242 | public function getDelete($id) |
243 | 243 | { |
244 | - if(!module()->canDelete()) return cb()->redirect(cb()->getAdminUrl(),"You do not have access to this area"); |
|
244 | + if (!module()->canDelete()) return cb()->redirect(cb()->getAdminUrl(), "You do not have access to this area"); |
|
245 | 245 | |
246 | - if(isset($this->data['hook_before_delete']) && is_callable($this->data['hook_before_delete'])) { |
|
246 | + if (isset($this->data['hook_before_delete']) && is_callable($this->data['hook_before_delete'])) { |
|
247 | 247 | call_user_func($this->data['hook_before_delete'], $id); |
248 | 248 | } |
249 | 249 | |
250 | - $softDelete = isset($this->data['disable_soft_delete'])?$this->data['disable_soft_delete']:true; |
|
250 | + $softDelete = isset($this->data['disable_soft_delete']) ? $this->data['disable_soft_delete'] : true; |
|
251 | 251 | |
252 | - if ($softDelete === true && Schema::hasColumn($this->data['table'],'deleted_at')) { |
|
252 | + if ($softDelete === true && Schema::hasColumn($this->data['table'], 'deleted_at')) { |
|
253 | 253 | DB::table($this->data['table']) |
254 | 254 | ->where(getPrimaryKey($this->data['table']), $id) |
255 | 255 | ->update(['deleted_at' => date('Y-m-d H:i:s')]); |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | ->delete(); |
260 | 260 | } |
261 | 261 | |
262 | - if(isset($this->data['hook_after_delete']) && is_callable($this->data['hook_after_delete'])) { |
|
262 | + if (isset($this->data['hook_after_delete']) && is_callable($this->data['hook_after_delete'])) { |
|
263 | 263 | call_user_func($this->data['hook_after_delete'], $id); |
264 | 264 | } |
265 | 265 | |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | |
269 | 269 | public function getDetail($id) |
270 | 270 | { |
271 | - if(!module()->canRead()) return cb()->redirect(cb()->getAdminUrl(),"You do not have access to this area"); |
|
271 | + if (!module()->canRead()) return cb()->redirect(cb()->getAdminUrl(), "You do not have access to this area"); |
|
272 | 272 | |
273 | 273 | $data = []; |
274 | 274 | $data['row'] = $this->repository()->where($this->data['table'].'.'.getPrimaryKey($this->data['table']), $id)->first(); |
@@ -278,21 +278,21 @@ discard block |
||
278 | 278 | |
279 | 279 | public function postUploadFile() |
280 | 280 | { |
281 | - if(auth()->guest()) return redirect(cb()->getLoginUrl()); |
|
281 | + if (auth()->guest()) return redirect(cb()->getLoginUrl()); |
|
282 | 282 | |
283 | 283 | $file = null; |
284 | 284 | try { |
285 | 285 | |
286 | 286 | cb()->validation([ |
287 | - 'userfile' => 'required|mimes:' . config('crudbooster.UPLOAD_TYPES') |
|
287 | + 'userfile' => 'required|mimes:'.config('crudbooster.UPLOAD_TYPES') |
|
288 | 288 | ]); |
289 | 289 | |
290 | 290 | $file = cb()->uploadFile('userfile', true); |
291 | 291 | |
292 | 292 | } catch (CBValidationException $e) { |
293 | - return response()->json(['status'=>false,'message'=>$e->getMessage()]); |
|
293 | + return response()->json(['status'=>false, 'message'=>$e->getMessage()]); |
|
294 | 294 | } catch (\Exception $e) { |
295 | - return response()->json(['status'=>false,'message'=>$e->getMessage()]); |
|
295 | + return response()->json(['status'=>false, 'message'=>$e->getMessage()]); |
|
296 | 296 | } |
297 | 297 | |
298 | 298 | return response()->json([ |
@@ -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 |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | if(in_array(request('order_by'),columnSingleton()->getColumnNameOnly())) { |
110 | 110 | $query->orderBy(request('order_by'), request('order_sort')); |
111 | 111 | } |
112 | - }else{ |
|
112 | + } else{ |
|
113 | 113 | if(isset($this->data['order_by'])) { |
114 | 114 | $query->orderBy($this->data['order_by'][0], $this->data['order_by'][1]); |
115 | 115 | } |
@@ -120,7 +120,9 @@ discard block |
||
120 | 120 | |
121 | 121 | public function getIndex() |
122 | 122 | { |
123 | - if(!module()->canBrowse()) return cb()->redirect(cb()->getAdminUrl(),"You do not have access to this area"); |
|
123 | + if(!module()->canBrowse()) { |
|
124 | + return cb()->redirect(cb()->getAdminUrl(),"You do not have access to this area"); |
|
125 | + } |
|
124 | 126 | |
125 | 127 | $query = $this->repository(); |
126 | 128 | $result = $query->paginate(20); |
@@ -146,7 +148,9 @@ discard block |
||
146 | 148 | |
147 | 149 | public function getAdd() |
148 | 150 | { |
149 | - if(!module()->canCreate()) return cb()->redirect(cb()->getAdminUrl(),"You do not have access to this area"); |
|
151 | + if(!module()->canCreate()) { |
|
152 | + return cb()->redirect(cb()->getAdminUrl(),"You do not have access to this area"); |
|
153 | + } |
|
150 | 154 | |
151 | 155 | $data = []; |
152 | 156 | $data['page_title'] = $this->data['page_title'].' : Add'; |
@@ -156,7 +160,9 @@ discard block |
||
156 | 160 | |
157 | 161 | public function postAddSave() |
158 | 162 | { |
159 | - if(!module()->canCreate()) return cb()->redirect(cb()->getAdminUrl(),"You do not have access to this area"); |
|
163 | + if(!module()->canCreate()) { |
|
164 | + return cb()->redirect(cb()->getAdminUrl(),"You do not have access to this area"); |
|
165 | + } |
|
160 | 166 | |
161 | 167 | try { |
162 | 168 | $this->validation(); |
@@ -190,7 +196,9 @@ discard block |
||
190 | 196 | |
191 | 197 | public function getEdit($id) |
192 | 198 | { |
193 | - if(!module()->canUpdate()) return cb()->redirect(cb()->getAdminUrl(),"You do not have access to this area"); |
|
199 | + if(!module()->canUpdate()) { |
|
200 | + return cb()->redirect(cb()->getAdminUrl(),"You do not have access to this area"); |
|
201 | + } |
|
194 | 202 | |
195 | 203 | $data = []; |
196 | 204 | $data['row'] = $this->repository()->where($this->data['table'].'.'.getPrimaryKey($this->data['table']), $id)->first(); |
@@ -201,7 +209,9 @@ discard block |
||
201 | 209 | |
202 | 210 | public function postEditSave($id) |
203 | 211 | { |
204 | - if(!module()->canUpdate()) return cb()->redirect(cb()->getAdminUrl(),"You do not have access to this area"); |
|
212 | + if(!module()->canUpdate()) { |
|
213 | + return cb()->redirect(cb()->getAdminUrl(),"You do not have access to this area"); |
|
214 | + } |
|
205 | 215 | |
206 | 216 | try { |
207 | 217 | $this->validation(); |
@@ -241,7 +251,9 @@ discard block |
||
241 | 251 | |
242 | 252 | public function getDelete($id) |
243 | 253 | { |
244 | - if(!module()->canDelete()) return cb()->redirect(cb()->getAdminUrl(),"You do not have access to this area"); |
|
254 | + if(!module()->canDelete()) { |
|
255 | + return cb()->redirect(cb()->getAdminUrl(),"You do not have access to this area"); |
|
256 | + } |
|
245 | 257 | |
246 | 258 | if(isset($this->data['hook_before_delete']) && is_callable($this->data['hook_before_delete'])) { |
247 | 259 | call_user_func($this->data['hook_before_delete'], $id); |
@@ -268,7 +280,9 @@ discard block |
||
268 | 280 | |
269 | 281 | public function getDetail($id) |
270 | 282 | { |
271 | - if(!module()->canRead()) return cb()->redirect(cb()->getAdminUrl(),"You do not have access to this area"); |
|
283 | + if(!module()->canRead()) { |
|
284 | + return cb()->redirect(cb()->getAdminUrl(),"You do not have access to this area"); |
|
285 | + } |
|
272 | 286 | |
273 | 287 | $data = []; |
274 | 288 | $data['row'] = $this->repository()->where($this->data['table'].'.'.getPrimaryKey($this->data['table']), $id)->first(); |
@@ -278,7 +292,9 @@ discard block |
||
278 | 292 | |
279 | 293 | public function postUploadFile() |
280 | 294 | { |
281 | - if(auth()->guest()) return redirect(cb()->getLoginUrl()); |
|
295 | + if(auth()->guest()) { |
|
296 | + return redirect(cb()->getLoginUrl()); |
|
297 | + } |
|
282 | 298 | |
283 | 299 | $file = null; |
284 | 300 | try { |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | public function getIndex() { |
27 | 27 | $data = []; |
28 | 28 | $data['result'] = DB::table("cb_modules")->get(); |
29 | - return view($this->view.'.index',$data); |
|
29 | + return view($this->view.'.index', $data); |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | public function getAdd() { |
@@ -37,11 +37,11 @@ discard block |
||
37 | 37 | |
38 | 38 | public function postAddSave() { |
39 | 39 | try { |
40 | - cb()->validation(['name', 'table','icon']); |
|
40 | + cb()->validation(['name', 'table', 'icon']); |
|
41 | 41 | |
42 | 42 | (new ModuleGenerator(request('table'), request('name'), request('icon')))->make(); |
43 | 43 | |
44 | - return cb()->redirect(route("DeveloperModulesControllerGetIndex"),"New module has been created!","success"); |
|
44 | + return cb()->redirect(route("DeveloperModulesControllerGetIndex"), "New module has been created!", "success"); |
|
45 | 45 | |
46 | 46 | } catch (CBValidationException $e) { |
47 | 47 | return cb()->redirectBack($e->getMessage()); |
@@ -58,9 +58,9 @@ discard block |
||
58 | 58 | try { |
59 | 59 | cb()->validation(['name', 'icon']); |
60 | 60 | |
61 | - cb()->updateCompact("cb_modules", $id, ['name','icon']); |
|
61 | + cb()->updateCompact("cb_modules", $id, ['name', 'icon']); |
|
62 | 62 | |
63 | - return cb()->redirect(route("DeveloperModulesControllerGetIndex"),"Module has been updated!","success"); |
|
63 | + return cb()->redirect(route("DeveloperModulesControllerGetIndex"), "Module has been updated!", "success"); |
|
64 | 64 | |
65 | 65 | } catch (CBValidationException $e) { |
66 | 66 | return cb()->redirectBack($e->getMessage()); |
@@ -68,12 +68,12 @@ discard block |
||
68 | 68 | } |
69 | 69 | |
70 | 70 | public function getDelete($id) { |
71 | - $module = cb()->find("cb_modules",$id); |
|
71 | + $module = cb()->find("cb_modules", $id); |
|
72 | 72 | @unlink(app_path("Http/Controllers/".$module->controller)); |
73 | 73 | DB::table("cb_modules")->where("id", $id)->delete(); |
74 | 74 | DB::table("cb_menus")->where("cb_modules_id", $id)->delete(); |
75 | 75 | |
76 | - return cb()->redirectBack("The module has been deleted!","success"); |
|
76 | + return cb()->redirectBack("The module has been deleted!", "success"); |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | } |
80 | 80 | \ No newline at end of file |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | |
8 | 8 | public function getLogin() |
9 | 9 | { |
10 | - if(!auth()->guest()) return redirect(cb()->getAdminUrl()); |
|
10 | + if (!auth()->guest()) return redirect(cb()->getAdminUrl()); |
|
11 | 11 | |
12 | 12 | cbHook()->hookGetLogin(); |
13 | 13 | |
@@ -16,20 +16,20 @@ discard block |
||
16 | 16 | |
17 | 17 | public function postLogin() |
18 | 18 | { |
19 | - try{ |
|
19 | + try { |
|
20 | 20 | cb()->validation([ |
21 | 21 | 'email'=>'required|email', |
22 | 22 | 'password'=>'required' |
23 | 23 | ]); |
24 | - $credential = request()->only(['email','password']); |
|
24 | + $credential = request()->only(['email', 'password']); |
|
25 | 25 | if (auth()->attempt($credential)) { |
26 | 26 | cbHook()->hookPostLogin(); |
27 | 27 | return redirect(cb()->getAdminUrl()); |
28 | 28 | } else { |
29 | - return redirect(cb()->getLoginUrl())->with(['message'=>__('crudbooster.alert_password_wrong'),'message_type'=>'warning']); |
|
29 | + return redirect(cb()->getLoginUrl())->with(['message'=>__('crudbooster.alert_password_wrong'), 'message_type'=>'warning']); |
|
30 | 30 | } |
31 | - }catch (CBValidationException $e) { |
|
32 | - return cb()->redirect(cb()->getAdminUrl("login"),$e->getMessage(),'warning'); |
|
31 | + } catch (CBValidationException $e) { |
|
32 | + return cb()->redirect(cb()->getAdminUrl("login"), $e->getMessage(), 'warning'); |
|
33 | 33 | } |
34 | 34 | } |
35 | 35 | |
@@ -44,25 +44,25 @@ discard block |
||
44 | 44 | } |
45 | 45 | |
46 | 46 | public function postLoginDeveloper() { |
47 | - try{ |
|
47 | + try { |
|
48 | 48 | cb()->validation([ |
49 | 49 | 'username'=>'required', |
50 | 50 | 'password'=>'required' |
51 | 51 | ]); |
52 | 52 | |
53 | - if(request('username') == config('crudbooster.DEV_USERNAME') |
|
53 | + if (request('username') == config('crudbooster.DEV_USERNAME') |
|
54 | 54 | && request('password') == config('crudbooster.DEV_PASSWORD')) { |
55 | 55 | |
56 | 56 | session(['developer'=>1]); |
57 | 57 | |
58 | 58 | return redirect(cb()->getDeveloperUrl()); |
59 | 59 | |
60 | - }else{ |
|
60 | + } else { |
|
61 | 61 | return cb()->redirectBack("Username and or password is wrong!"); |
62 | 62 | } |
63 | 63 | |
64 | - }catch (CBValidationException $e) { |
|
65 | - return cb()->redirect(cb()->getLoginUrl(),$e->getMessage(),'warning'); |
|
64 | + } catch (CBValidationException $e) { |
|
65 | + return cb()->redirect(cb()->getLoginUrl(), $e->getMessage(), 'warning'); |
|
66 | 66 | } |
67 | 67 | } |
68 | 68 |
@@ -7,7 +7,9 @@ discard block |
||
7 | 7 | |
8 | 8 | public function getLogin() |
9 | 9 | { |
10 | - if(!auth()->guest()) return redirect(cb()->getAdminUrl()); |
|
10 | + if(!auth()->guest()) { |
|
11 | + return redirect(cb()->getAdminUrl()); |
|
12 | + } |
|
11 | 13 | |
12 | 14 | cbHook()->hookGetLogin(); |
13 | 15 | |
@@ -28,7 +30,7 @@ discard block |
||
28 | 30 | } else { |
29 | 31 | return redirect(cb()->getLoginUrl())->with(['message'=>__('crudbooster.alert_password_wrong'),'message_type'=>'warning']); |
30 | 32 | } |
31 | - }catch (CBValidationException $e) { |
|
33 | + } catch (CBValidationException $e) { |
|
32 | 34 | return cb()->redirect(cb()->getAdminUrl("login"),$e->getMessage(),'warning'); |
33 | 35 | } |
34 | 36 | } |
@@ -57,11 +59,11 @@ discard block |
||
57 | 59 | |
58 | 60 | return redirect(cb()->getDeveloperUrl()); |
59 | 61 | |
60 | - }else{ |
|
62 | + } else{ |
|
61 | 63 | return cb()->redirectBack("Username and or password is wrong!"); |
62 | 64 | } |
63 | 65 | |
64 | - }catch (CBValidationException $e) { |
|
66 | + } catch (CBValidationException $e) { |
|
65 | 67 | return cb()->redirect(cb()->getLoginUrl(),$e->getMessage(),'warning'); |
66 | 68 | } |
67 | 69 | } |
@@ -25,14 +25,14 @@ discard block |
||
25 | 25 | { |
26 | 26 | $routeArray = request()->route()->getAction(); |
27 | 27 | $this->controller = class_basename($routeArray['controller']); |
28 | - $this->controller = strtok($this->controller,"@"); |
|
28 | + $this->controller = strtok($this->controller, "@"); |
|
29 | 29 | |
30 | 30 | $className = "\\".$routeArray["namespace"]."\\".$this->controller; |
31 | - if(class_exists($className)) { |
|
31 | + if (class_exists($className)) { |
|
32 | 32 | $this->controller_class = new $className(); |
33 | - $this->module = cb()->find("cb_modules",["controller"=>$this->controller]); |
|
34 | - $this->menu = cb()->find("cb_menus",["cb_modules_id"=>$this->module->id]); |
|
35 | - $this->menu = (!$this->menu)?cb()->find("cb_menus",["type"=>"path","path"=>request()->segment(2)]):$this->menu; |
|
33 | + $this->module = cb()->find("cb_modules", ["controller"=>$this->controller]); |
|
34 | + $this->menu = cb()->find("cb_menus", ["cb_modules_id"=>$this->module->id]); |
|
35 | + $this->menu = (!$this->menu) ?cb()->find("cb_menus", ["type"=>"path", "path"=>request()->segment(2)]) : $this->menu; |
|
36 | 36 | $this->privilege = DB::table("cb_role_privileges") |
37 | 37 | ->where("cb_menus_id", $this->menu->id) |
38 | 38 | ->where("cb_roles_id", cb()->session()->roleId()) |
@@ -49,135 +49,135 @@ discard block |
||
49 | 49 | } |
50 | 50 | |
51 | 51 | public function getData($key) { |
52 | - return ($this->controller_class)?$this->controller_class->getData($key)?:cb()->getAppName():null; |
|
52 | + return ($this->controller_class) ? $this->controller_class->getData($key) ?: cb()->getAppName() : null; |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | /** |
56 | 56 | * @return CBController |
57 | 57 | */ |
58 | 58 | public function getController() { |
59 | - return ($this->controller_class)?$this->controller_class:null; |
|
59 | + return ($this->controller_class) ? $this->controller_class : null; |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | public function getPageTitle() |
63 | 63 | { |
64 | - return ($this->controller_class)?$this->controller_class->getData("page_title")?:cb()->getAppName():null; |
|
64 | + return ($this->controller_class) ? $this->controller_class->getData("page_title") ?: cb()->getAppName() : null; |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | public function getTable() |
68 | 68 | { |
69 | - return ($this->controller_class)?$this->controller_class->getData("table"):null; |
|
69 | + return ($this->controller_class) ? $this->controller_class->getData("table") : null; |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | public function getPageIcon() |
73 | 73 | { |
74 | - return ($this->controller_class)?$this->controller_class->getData('page_icon')?:"fa fa-bars":null; |
|
74 | + return ($this->controller_class) ? $this->controller_class->getData('page_icon') ?: "fa fa-bars" : null; |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | public function canBrowse() { |
78 | - if($this->privilege) { |
|
79 | - if($this->privilege->can_browse) return true; |
|
78 | + if ($this->privilege) { |
|
79 | + if ($this->privilege->can_browse) return true; |
|
80 | 80 | else return false; |
81 | - }else{ |
|
81 | + } else { |
|
82 | 82 | return true; |
83 | 83 | } |
84 | 84 | } |
85 | 85 | |
86 | 86 | public function canCreate() { |
87 | - if($this->privilege) { |
|
88 | - if($this->privilege->can_create) return true; |
|
87 | + if ($this->privilege) { |
|
88 | + if ($this->privilege->can_create) return true; |
|
89 | 89 | else return false; |
90 | - }else{ |
|
90 | + } else { |
|
91 | 91 | return true; |
92 | 92 | } |
93 | 93 | } |
94 | 94 | |
95 | 95 | public function canRead() { |
96 | - if($this->privilege) { |
|
97 | - if($this->privilege->can_read) return true; |
|
96 | + if ($this->privilege) { |
|
97 | + if ($this->privilege->can_read) return true; |
|
98 | 98 | else return false; |
99 | - }else{ |
|
99 | + } else { |
|
100 | 100 | return true; |
101 | 101 | } |
102 | 102 | } |
103 | 103 | |
104 | 104 | public function canUpdate() { |
105 | - if($this->privilege) { |
|
106 | - if($this->privilege->can_update) return true; |
|
105 | + if ($this->privilege) { |
|
106 | + if ($this->privilege->can_update) return true; |
|
107 | 107 | else return false; |
108 | - }else{ |
|
108 | + } else { |
|
109 | 109 | return true; |
110 | 110 | } |
111 | 111 | } |
112 | 112 | |
113 | 113 | public function canDelete() { |
114 | - if($this->privilege) { |
|
115 | - if($this->privilege->can_delete) return true; |
|
114 | + if ($this->privilege) { |
|
115 | + if ($this->privilege->can_delete) return true; |
|
116 | 116 | else return false; |
117 | - }else{ |
|
117 | + } else { |
|
118 | 118 | return true; |
119 | 119 | } |
120 | 120 | } |
121 | 121 | |
122 | 122 | public function addURL() |
123 | 123 | { |
124 | - if($this->controller_class && method_exists($this->controller_class, 'getAdd')) { |
|
124 | + if ($this->controller_class && method_exists($this->controller_class, 'getAdd')) { |
|
125 | 125 | return action($this->controller.'@getAdd'); |
126 | - }else{ |
|
126 | + } else { |
|
127 | 127 | return null; |
128 | 128 | } |
129 | 129 | } |
130 | 130 | |
131 | 131 | public function addSaveURL() |
132 | 132 | { |
133 | - if($this->controller_class && method_exists($this->controller_class, 'postAddSave')) { |
|
133 | + if ($this->controller_class && method_exists($this->controller_class, 'postAddSave')) { |
|
134 | 134 | return action($this->controller.'@postAddSave'); |
135 | - }else{ |
|
135 | + } else { |
|
136 | 136 | return null; |
137 | 137 | } |
138 | 138 | } |
139 | 139 | |
140 | 140 | public function editURL($id = null) |
141 | 141 | { |
142 | - if($this->controller_class && method_exists($this->controller_class, 'getEdit')) { |
|
143 | - return action($this->controller.'@getEdit',['id'=>$id]); |
|
144 | - }else{ |
|
142 | + if ($this->controller_class && method_exists($this->controller_class, 'getEdit')) { |
|
143 | + return action($this->controller.'@getEdit', ['id'=>$id]); |
|
144 | + } else { |
|
145 | 145 | return null; |
146 | 146 | } |
147 | 147 | } |
148 | 148 | |
149 | 149 | public function editSaveURL($id = null) |
150 | 150 | { |
151 | - if(method_exists($this->controller_class, 'postEditSave')) { |
|
152 | - return action($this->controller.'@postEditSave',['id'=>$id]); |
|
153 | - }else{ |
|
151 | + if (method_exists($this->controller_class, 'postEditSave')) { |
|
152 | + return action($this->controller.'@postEditSave', ['id'=>$id]); |
|
153 | + } else { |
|
154 | 154 | return null; |
155 | 155 | } |
156 | 156 | } |
157 | 157 | |
158 | - public function detailURL($id=null) |
|
158 | + public function detailURL($id = null) |
|
159 | 159 | { |
160 | - if($this->controller_class && method_exists($this->controller_class, 'getDetail')) { |
|
161 | - return action($this->controller.'@getDetail',['id'=>$id]); |
|
162 | - }else{ |
|
160 | + if ($this->controller_class && method_exists($this->controller_class, 'getDetail')) { |
|
161 | + return action($this->controller.'@getDetail', ['id'=>$id]); |
|
162 | + } else { |
|
163 | 163 | return null; |
164 | 164 | } |
165 | 165 | } |
166 | 166 | |
167 | - public function deleteURL($id=null) |
|
167 | + public function deleteURL($id = null) |
|
168 | 168 | { |
169 | - if($this->controller_class && method_exists($this->controller_class, 'getDelete')) { |
|
170 | - return action($this->controller.'@getDelete',['id'=>$id]); |
|
171 | - }else{ |
|
169 | + if ($this->controller_class && method_exists($this->controller_class, 'getDelete')) { |
|
170 | + return action($this->controller.'@getDelete', ['id'=>$id]); |
|
171 | + } else { |
|
172 | 172 | return null; |
173 | 173 | } |
174 | 174 | } |
175 | 175 | |
176 | 176 | public function url($path = null) |
177 | 177 | { |
178 | - if($this->controller_class && method_exists($this->controller_class, 'getIndex')) { |
|
179 | - return trim(action($this->controller.'@getIndex').'/'.$path,'/'); |
|
180 | - }else{ |
|
178 | + if ($this->controller_class && method_exists($this->controller_class, 'getIndex')) { |
|
179 | + return trim(action($this->controller.'@getIndex').'/'.$path, '/'); |
|
180 | + } else { |
|
181 | 181 | return null; |
182 | 182 | } |
183 | 183 | } |
@@ -76,45 +76,60 @@ discard block |
||
76 | 76 | |
77 | 77 | public function canBrowse() { |
78 | 78 | if($this->privilege) { |
79 | - if($this->privilege->can_browse) return true; |
|
80 | - else return false; |
|
81 | - }else{ |
|
79 | + if($this->privilege->can_browse) { |
|
80 | + return true; |
|
81 | + } else { |
|
82 | + return false; |
|
83 | + } |
|
84 | + } else{ |
|
82 | 85 | return true; |
83 | 86 | } |
84 | 87 | } |
85 | 88 | |
86 | 89 | public function canCreate() { |
87 | 90 | if($this->privilege) { |
88 | - if($this->privilege->can_create) return true; |
|
89 | - else return false; |
|
90 | - }else{ |
|
91 | + if($this->privilege->can_create) { |
|
92 | + return true; |
|
93 | + } else { |
|
94 | + return false; |
|
95 | + } |
|
96 | + } else{ |
|
91 | 97 | return true; |
92 | 98 | } |
93 | 99 | } |
94 | 100 | |
95 | 101 | public function canRead() { |
96 | 102 | if($this->privilege) { |
97 | - if($this->privilege->can_read) return true; |
|
98 | - else return false; |
|
99 | - }else{ |
|
103 | + if($this->privilege->can_read) { |
|
104 | + return true; |
|
105 | + } else { |
|
106 | + return false; |
|
107 | + } |
|
108 | + } else{ |
|
100 | 109 | return true; |
101 | 110 | } |
102 | 111 | } |
103 | 112 | |
104 | 113 | public function canUpdate() { |
105 | 114 | if($this->privilege) { |
106 | - if($this->privilege->can_update) return true; |
|
107 | - else return false; |
|
108 | - }else{ |
|
115 | + if($this->privilege->can_update) { |
|
116 | + return true; |
|
117 | + } else { |
|
118 | + return false; |
|
119 | + } |
|
120 | + } else{ |
|
109 | 121 | return true; |
110 | 122 | } |
111 | 123 | } |
112 | 124 | |
113 | 125 | public function canDelete() { |
114 | 126 | if($this->privilege) { |
115 | - if($this->privilege->can_delete) return true; |
|
116 | - else return false; |
|
117 | - }else{ |
|
127 | + if($this->privilege->can_delete) { |
|
128 | + return true; |
|
129 | + } else { |
|
130 | + return false; |
|
131 | + } |
|
132 | + } else{ |
|
118 | 133 | return true; |
119 | 134 | } |
120 | 135 | } |
@@ -123,7 +138,7 @@ discard block |
||
123 | 138 | { |
124 | 139 | if($this->controller_class && method_exists($this->controller_class, 'getAdd')) { |
125 | 140 | return action($this->controller.'@getAdd'); |
126 | - }else{ |
|
141 | + } else{ |
|
127 | 142 | return null; |
128 | 143 | } |
129 | 144 | } |
@@ -132,7 +147,7 @@ discard block |
||
132 | 147 | { |
133 | 148 | if($this->controller_class && method_exists($this->controller_class, 'postAddSave')) { |
134 | 149 | return action($this->controller.'@postAddSave'); |
135 | - }else{ |
|
150 | + } else{ |
|
136 | 151 | return null; |
137 | 152 | } |
138 | 153 | } |
@@ -141,7 +156,7 @@ discard block |
||
141 | 156 | { |
142 | 157 | if($this->controller_class && method_exists($this->controller_class, 'getEdit')) { |
143 | 158 | return action($this->controller.'@getEdit',['id'=>$id]); |
144 | - }else{ |
|
159 | + } else{ |
|
145 | 160 | return null; |
146 | 161 | } |
147 | 162 | } |
@@ -150,7 +165,7 @@ discard block |
||
150 | 165 | { |
151 | 166 | if(method_exists($this->controller_class, 'postEditSave')) { |
152 | 167 | return action($this->controller.'@postEditSave',['id'=>$id]); |
153 | - }else{ |
|
168 | + } else{ |
|
154 | 169 | return null; |
155 | 170 | } |
156 | 171 | } |
@@ -159,7 +174,7 @@ discard block |
||
159 | 174 | { |
160 | 175 | if($this->controller_class && method_exists($this->controller_class, 'getDetail')) { |
161 | 176 | return action($this->controller.'@getDetail',['id'=>$id]); |
162 | - }else{ |
|
177 | + } else{ |
|
163 | 178 | return null; |
164 | 179 | } |
165 | 180 | } |
@@ -168,7 +183,7 @@ discard block |
||
168 | 183 | { |
169 | 184 | if($this->controller_class && method_exists($this->controller_class, 'getDelete')) { |
170 | 185 | return action($this->controller.'@getDelete',['id'=>$id]); |
171 | - }else{ |
|
186 | + } else{ |
|
172 | 187 | return null; |
173 | 188 | } |
174 | 189 | } |
@@ -177,7 +192,7 @@ discard block |
||
177 | 192 | { |
178 | 193 | if($this->controller_class && method_exists($this->controller_class, 'getIndex')) { |
179 | 194 | return trim(action($this->controller.'@getIndex').'/'.$path,'/'); |
180 | - }else{ |
|
195 | + } else{ |
|
181 | 196 | return null; |
182 | 197 | } |
183 | 198 | } |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | | |
10 | 10 | */ |
11 | 11 | |
12 | -if(!function_exists('convertPHPToMomentFormat')) { |
|
12 | +if (!function_exists('convertPHPToMomentFormat')) { |
|
13 | 13 | function convertPHPToMomentFormat($format) |
14 | 14 | { |
15 | 15 | $replacements = [ |
@@ -56,13 +56,13 @@ discard block |
||
56 | 56 | } |
57 | 57 | } |
58 | 58 | |
59 | -if(!function_exists('slug')) { |
|
59 | +if (!function_exists('slug')) { |
|
60 | 60 | function slug($string, $separator = '-') { |
61 | 61 | return \Illuminate\Support\Str::slug($string, $separator); |
62 | 62 | } |
63 | 63 | } |
64 | 64 | |
65 | -if(!function_exists('columnSingleton')) { |
|
65 | +if (!function_exists('columnSingleton')) { |
|
66 | 66 | /** |
67 | 67 | * @return \crocodicstudio\crudbooster\controllers\scaffolding\singletons\ColumnSingleton |
68 | 68 | */ |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | } |
72 | 72 | } |
73 | 73 | |
74 | -if(!function_exists('cbHook')) |
|
74 | +if (!function_exists('cbHook')) |
|
75 | 75 | { |
76 | 76 | /** |
77 | 77 | * @return crocodicstudio\crudbooster\hooks\CBHook |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | } |
84 | 84 | } |
85 | 85 | |
86 | -if(!function_exists('getTypeHook')) |
|
86 | +if (!function_exists('getTypeHook')) |
|
87 | 87 | { |
88 | 88 | /** |
89 | 89 | * @param string $type |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | } |
97 | 97 | } |
98 | 98 | |
99 | -if(!function_exists('getPrimaryKey')) |
|
99 | +if (!function_exists('getPrimaryKey')) |
|
100 | 100 | { |
101 | 101 | function getPrimaryKey($table_name) |
102 | 102 | { |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | } |
105 | 105 | } |
106 | 106 | |
107 | -if(!function_exists('cb')) |
|
107 | +if (!function_exists('cb')) |
|
108 | 108 | { |
109 | 109 | function cb() |
110 | 110 | { |
@@ -112,25 +112,25 @@ discard block |
||
112 | 112 | } |
113 | 113 | } |
114 | 114 | |
115 | -if(!function_exists('cbAsset')) { |
|
115 | +if (!function_exists('cbAsset')) { |
|
116 | 116 | function cbAsset($path) { |
117 | 117 | return asset("cb_asset/".$path); |
118 | 118 | } |
119 | 119 | } |
120 | 120 | |
121 | -if(!function_exists("cbConfig")) { |
|
121 | +if (!function_exists("cbConfig")) { |
|
122 | 122 | function cbConfig($name) { |
123 | 123 | return config("crudbooster.".$name); |
124 | 124 | } |
125 | 125 | } |
126 | 126 | |
127 | -if(!function_exists("strRandom")) { |
|
127 | +if (!function_exists("strRandom")) { |
|
128 | 128 | function strRandom($length = 5) { |
129 | 129 | return \Illuminate\Support\Str::random($length); |
130 | 130 | } |
131 | 131 | } |
132 | 132 | |
133 | -if(!function_exists('module')) { |
|
133 | +if (!function_exists('module')) { |
|
134 | 134 | function module() |
135 | 135 | { |
136 | 136 | $module = new \crocodicstudio\crudbooster\helpers\Module(); |
@@ -138,43 +138,43 @@ discard block |
||
138 | 138 | } |
139 | 139 | } |
140 | 140 | |
141 | -if(!function_exists('getAdminLoginURL')) { |
|
141 | +if (!function_exists('getAdminLoginURL')) { |
|
142 | 142 | function getAdminLoginURL() |
143 | 143 | { |
144 | 144 | return url(config('crudbooster.ADMIN_LOGIN_PATH')); |
145 | 145 | } |
146 | 146 | } |
147 | 147 | |
148 | -if(!function_exists('dummyPhoto')) { |
|
148 | +if (!function_exists('dummyPhoto')) { |
|
149 | 149 | function dummyPhoto() |
150 | 150 | { |
151 | 151 | return config('crudbooster.DUMMY_PHOTO'); |
152 | 152 | } |
153 | 153 | } |
154 | 154 | |
155 | -if(!function_exists('assetThumbnail')) { |
|
155 | +if (!function_exists('assetThumbnail')) { |
|
156 | 156 | function assetThumbnail($path) { |
157 | - $path = str_replace('uploads/','uploads_thumbnail/',$path); |
|
157 | + $path = str_replace('uploads/', 'uploads_thumbnail/', $path); |
|
158 | 158 | return asset($path); |
159 | 159 | } |
160 | 160 | } |
161 | 161 | |
162 | -if(!function_exists('assetResize')) { |
|
163 | - function assetResize($path,$width,$height=null,$quality=70) { |
|
162 | +if (!function_exists('assetResize')) { |
|
163 | + function assetResize($path, $width, $height = null, $quality = 70) { |
|
164 | 164 | $basename = basename($path); |
165 | 165 | $pathWithoutName = str_replace($basename, '', $path); |
166 | 166 | $newLocation = $pathWithoutName.'/w_'.$width.'_h_'.$height.'_'.$basename; |
167 | - if(Storage::exists($newLocation)) { |
|
167 | + if (Storage::exists($newLocation)) { |
|
168 | 168 | return asset($newLocation); |
169 | - }else{ |
|
170 | - $img = Image::make(storage_path($path))->fit($width,$height); |
|
171 | - $img->save(storage_path($newLocation),$quality); |
|
169 | + } else { |
|
170 | + $img = Image::make(storage_path($path))->fit($width, $height); |
|
171 | + $img->save(storage_path($newLocation), $quality); |
|
172 | 172 | return asset($newLocation); |
173 | 173 | } |
174 | 174 | } |
175 | 175 | } |
176 | 176 | |
177 | -if(!function_exists('extract_unit')) { |
|
177 | +if (!function_exists('extract_unit')) { |
|
178 | 178 | /* |
179 | 179 | Credits: Bit Repository |
180 | 180 | URL: http://www.bitrepository.com/extract-content-between-two-delimiters-with-php.html |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | } |
193 | 193 | |
194 | 194 | |
195 | -if(!function_exists('now')) { |
|
195 | +if (!function_exists('now')) { |
|
196 | 196 | function now() { |
197 | 197 | return date('Y-m-d H:i:s'); |
198 | 198 | } |
@@ -206,13 +206,13 @@ discard block |
||
206 | 206 | | |
207 | 207 | */ |
208 | 208 | |
209 | -if(!function_exists('putSetting')) { |
|
209 | +if (!function_exists('putSetting')) { |
|
210 | 210 | function putSetting($key, $value) |
211 | 211 | { |
212 | - if(file_exists(storage_path('.cbconfig'))) { |
|
212 | + if (file_exists(storage_path('.cbconfig'))) { |
|
213 | 213 | $settings = file_get_contents(storage_path('.cbconfig')); |
214 | 214 | $settings = unserialize($settings); |
215 | - }else{ |
|
215 | + } else { |
|
216 | 216 | $settings = []; |
217 | 217 | } |
218 | 218 | |
@@ -223,25 +223,25 @@ discard block |
||
223 | 223 | } |
224 | 224 | } |
225 | 225 | |
226 | -if(!function_exists('getSetting')) { |
|
226 | +if (!function_exists('getSetting')) { |
|
227 | 227 | function getSetting($key, $default = null) |
228 | 228 | { |
229 | - if(file_exists(storage_path('.cbconfig'))) { |
|
229 | + if (file_exists(storage_path('.cbconfig'))) { |
|
230 | 230 | $settings = file_get_contents(storage_path('.cbconfig')); |
231 | 231 | $settings = unserialize($settings); |
232 | - }else{ |
|
232 | + } else { |
|
233 | 233 | $settings = []; |
234 | 234 | } |
235 | 235 | |
236 | - if(isset($settings[$key])) { |
|
237 | - return $settings[$key]?:$default; |
|
238 | - }else{ |
|
236 | + if (isset($settings[$key])) { |
|
237 | + return $settings[$key] ?: $default; |
|
238 | + } else { |
|
239 | 239 | return $default; |
240 | 240 | } |
241 | 241 | } |
242 | 242 | } |
243 | 243 | |
244 | -if(!function_exists('timeAgo')) { |
|
244 | +if (!function_exists('timeAgo')) { |
|
245 | 245 | function timeAgo($datetime_to, $datetime_from = null, $full = false) |
246 | 246 | { |
247 | 247 | $datetime_from = ($datetime_from) ?: date('Y-m-d H:i:s'); |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | } |
273 | 273 | } |
274 | 274 | |
275 | - if (! $full) { |
|
275 | + if (!$full) { |
|
276 | 276 | $string = array_slice($string, 0, 1); |
277 | 277 | } |
278 | 278 | |
@@ -280,22 +280,22 @@ discard block |
||
280 | 280 | } |
281 | 281 | } |
282 | 282 | |
283 | -if(!function_exists("array_map_r")) { |
|
284 | - function array_map_r( $func, $arr ) |
|
283 | +if (!function_exists("array_map_r")) { |
|
284 | + function array_map_r($func, $arr) |
|
285 | 285 | { |
286 | 286 | $newArr = array(); |
287 | 287 | |
288 | - foreach( $arr as $key => $value ) |
|
288 | + foreach ($arr as $key => $value) |
|
289 | 289 | { |
290 | 290 | $key = $func($key); |
291 | - $newArr[ $key ] = ( is_array( $value ) ? array_map_r( $func, $value ) : ( is_array($func) ? call_user_func_array($func, $value) : $func( $value ) ) ); |
|
291 | + $newArr[$key] = (is_array($value) ? array_map_r($func, $value) : (is_array($func) ? call_user_func_array($func, $value) : $func($value))); |
|
292 | 292 | } |
293 | 293 | |
294 | 294 | return $newArr; |
295 | 295 | } |
296 | 296 | } |
297 | 297 | |
298 | -if(!function_exists("sanitizeXSS")) |
|
298 | +if (!function_exists("sanitizeXSS")) |
|
299 | 299 | { |
300 | 300 | function sanitizeXSS($value) |
301 | 301 | { |
@@ -307,7 +307,7 @@ discard block |
||
307 | 307 | } |
308 | 308 | } |
309 | 309 | |
310 | -if(!function_exists("requestAll")) { |
|
310 | +if (!function_exists("requestAll")) { |
|
311 | 311 | function requestAll() { |
312 | 312 | $all = array_map_r("sanitizeXSS", request()->all()); |
313 | 313 | return $all; |
@@ -316,22 +316,22 @@ discard block |
||
316 | 316 | |
317 | 317 | |
318 | 318 | |
319 | -if(!function_exists('getURLFormat')) { |
|
319 | +if (!function_exists('getURLFormat')) { |
|
320 | 320 | function getURLFormat($name) { |
321 | 321 | $url = request($name); |
322 | - if(filter_var($url, FILTER_VALIDATE_URL)) { |
|
322 | + if (filter_var($url, FILTER_VALIDATE_URL)) { |
|
323 | 323 | return $url; |
324 | - }else{ |
|
324 | + } else { |
|
325 | 325 | return request()->url(); |
326 | 326 | } |
327 | 327 | } |
328 | 328 | } |
329 | 329 | |
330 | -if(!function_exists('g')) { |
|
330 | +if (!function_exists('g')) { |
|
331 | 331 | function g($name, $safe = true) { |
332 | - if($safe == true) { |
|
332 | + if ($safe == true) { |
|
333 | 333 | $response = request($name); |
334 | - if(is_string($response)) { |
|
334 | + if (is_string($response)) { |
|
335 | 335 | $response = sanitizeXSS($response); |
336 | 336 | }elseif (is_array($response)) { |
337 | 337 | array_walk_recursive($response, function(&$response) { |
@@ -340,25 +340,25 @@ discard block |
||
340 | 340 | } |
341 | 341 | |
342 | 342 | return $response; |
343 | - }else{ |
|
343 | + } else { |
|
344 | 344 | return Request::get($name); |
345 | 345 | } |
346 | 346 | } |
347 | 347 | } |
348 | 348 | |
349 | -if(!function_exists('min_var_export')) { |
|
349 | +if (!function_exists('min_var_export')) { |
|
350 | 350 | function min_var_export($input) { |
351 | - if(is_array($input)) { |
|
351 | + if (is_array($input)) { |
|
352 | 352 | $buffer = []; |
353 | - foreach($input as $key => $value) |
|
353 | + foreach ($input as $key => $value) |
|
354 | 354 | $buffer[] = var_export($key, true)."=>".min_var_export($value); |
355 | - return "[".implode(",",$buffer)."]"; |
|
355 | + return "[".implode(",", $buffer)."]"; |
|
356 | 356 | } else |
357 | 357 | return var_export($input, true); |
358 | 358 | } |
359 | 359 | } |
360 | 360 | |
361 | -if(!function_exists('rrmdir')) { |
|
361 | +if (!function_exists('rrmdir')) { |
|
362 | 362 | /* |
363 | 363 | * http://stackoverflow.com/questions/3338123/how-do-i-recursively-delete-a-directory-and-its-entire-contents-files-sub-dir |
364 | 364 | */ |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | $template = file_get_contents(__DIR__."/../templates/FooBarController.stub"); |
44 | 44 | |
45 | 45 | //Replace table |
46 | - $template = str_replace("{table}",'"'.$this->table.'"', $template); |
|
46 | + $template = str_replace("{table}", '"'.$this->table.'"', $template); |
|
47 | 47 | |
48 | 48 | //Replace permalink |
49 | 49 | $template = str_replace("{permalink}", '"'.$this->table.'"', $template); |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | //Replace scaffolding |
52 | 52 | $fields = DB::getSchemaBuilder()->getColumnListing($this->table); |
53 | 53 | $scaffold = ""; |
54 | - foreach($fields as $field) { |
|
54 | + foreach ($fields as $field) { |
|
55 | 55 | $scaffold .= '$this->addText("'.$field.'");'."\n\t\t"; |
56 | 56 | } |
57 | 57 | $template = str_replace("{scaffolding}", $scaffold, $template); |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | |
67 | 67 | //Save to database |
68 | 68 | $module = []; |
69 | - $module['name'] = ($this->name)?:ucwords(str_replace("_"," ",$this->table)); |
|
69 | + $module['name'] = ($this->name) ?: ucwords(str_replace("_", " ", $this->table)); |
|
70 | 70 | $module['icon'] = $this->icon; |
71 | 71 | $module['table_name'] = $this->table; |
72 | 72 | $module['controller'] = $filename; |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | private function assignToModel($menu) { |
23 | 23 | $model = new SidebarModel(); |
24 | 24 | $model->setId($menu->id); |
25 | - if($menu->type == "url") { |
|
25 | + if ($menu->type == "url") { |
|
26 | 26 | $model->setUrl($menu->path); |
27 | 27 | $model->setIcon($menu->icon); |
28 | 28 | $model->setName($menu->name); |
@@ -47,22 +47,22 @@ discard block |
||
47 | 47 | |
48 | 48 | private function loadData($parent_id = null) { |
49 | 49 | $menus = DB::table("cb_menus"); |
50 | - if($parent_id) { |
|
51 | - $menus->where("parent_cb_menus_id",$parent_id); |
|
52 | - }else{ |
|
50 | + if ($parent_id) { |
|
51 | + $menus->where("parent_cb_menus_id", $parent_id); |
|
52 | + } else { |
|
53 | 53 | $menus->whereNull("parent_cb_menus_id"); |
54 | 54 | } |
55 | - return $menus->orderBy("sort_number","asc")->get(); |
|
55 | + return $menus->orderBy("sort_number", "asc")->get(); |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | private function rolePrivilege($cb_roles_id, $cb_menus_id) { |
59 | - return cb()->find("cb_role_privileges",['cb_roles_id'=>$cb_roles_id,'cb_menus_id'=>$cb_menus_id]); |
|
59 | + return cb()->find("cb_role_privileges", ['cb_roles_id'=>$cb_roles_id, 'cb_menus_id'=>$cb_menus_id]); |
|
60 | 60 | } |
61 | 61 | |
62 | - private function checkPrivilege($roles_id,$menu) { |
|
63 | - if($roles_id) { |
|
62 | + private function checkPrivilege($roles_id, $menu) { |
|
63 | + if ($roles_id) { |
|
64 | 64 | $privilege = $this->rolePrivilege($roles_id, $menu->id); |
65 | - if(!$privilege->can_browse) { |
|
65 | + if (!$privilege->can_browse) { |
|
66 | 66 | return false; |
67 | 67 | } |
68 | 68 | } |
@@ -71,26 +71,26 @@ discard block |
||
71 | 71 | } |
72 | 72 | |
73 | 73 | public function all($withPrivilege = true) { |
74 | - $roles_id = ($withPrivilege)?cb()->session()->roleId():null; |
|
74 | + $roles_id = ($withPrivilege) ?cb()->session()->roleId() : null; |
|
75 | 75 | $menus = $this->loadData(); |
76 | 76 | $result = []; |
77 | - foreach($menus as $menu) { |
|
77 | + foreach ($menus as $menu) { |
|
78 | 78 | |
79 | - if($withPrivilege && !$this->checkPrivilege($roles_id, $menu)) continue; |
|
79 | + if ($withPrivilege && !$this->checkPrivilege($roles_id, $menu)) continue; |
|
80 | 80 | |
81 | 81 | $sidebarModel = $this->assignToModel($menu); |
82 | - if($menus2 = $this->loadData($menu->id)) { |
|
82 | + if ($menus2 = $this->loadData($menu->id)) { |
|
83 | 83 | $sub1 = []; |
84 | 84 | foreach ($menus2 as $menu2) { |
85 | 85 | |
86 | - if($withPrivilege && !$this->checkPrivilege($roles_id, $menu2)) continue; |
|
86 | + if ($withPrivilege && !$this->checkPrivilege($roles_id, $menu2)) continue; |
|
87 | 87 | |
88 | 88 | $sidebarModel2 = $this->assignToModel($menu2); |
89 | - if($menus3 = $this->loadData($menu2->id)) { |
|
89 | + if ($menus3 = $this->loadData($menu2->id)) { |
|
90 | 90 | $sub2 = []; |
91 | 91 | foreach ($menus3 as $menu3) { |
92 | 92 | |
93 | - if($withPrivilege && !$this->checkPrivilege($roles_id, $menu3)) continue; |
|
93 | + if ($withPrivilege && !$this->checkPrivilege($roles_id, $menu3)) continue; |
|
94 | 94 | |
95 | 95 | $sidebarModel3 = $this->assignToModel($menu3); |
96 | 96 | $sub2[] = $sidebarModel3; |
@@ -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(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); |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | $menus = DB::table("cb_menus"); |
50 | 50 | if($parent_id) { |
51 | 51 | $menus->where("parent_cb_menus_id",$parent_id); |
52 | - }else{ |
|
52 | + } else{ |
|
53 | 53 | $menus->whereNull("parent_cb_menus_id"); |
54 | 54 | } |
55 | 55 | return $menus->orderBy("sort_number","asc")->get(); |
@@ -76,21 +76,27 @@ discard block |
||
76 | 76 | $result = []; |
77 | 77 | foreach($menus as $menu) { |
78 | 78 | |
79 | - if($withPrivilege && !$this->checkPrivilege($roles_id, $menu)) continue; |
|
79 | + if($withPrivilege && !$this->checkPrivilege($roles_id, $menu)) { |
|
80 | + continue; |
|
81 | + } |
|
80 | 82 | |
81 | 83 | $sidebarModel = $this->assignToModel($menu); |
82 | 84 | if($menus2 = $this->loadData($menu->id)) { |
83 | 85 | $sub1 = []; |
84 | 86 | foreach ($menus2 as $menu2) { |
85 | 87 | |
86 | - if($withPrivilege && !$this->checkPrivilege($roles_id, $menu2)) continue; |
|
88 | + if($withPrivilege && !$this->checkPrivilege($roles_id, $menu2)) { |
|
89 | + continue; |
|
90 | + } |
|
87 | 91 | |
88 | 92 | $sidebarModel2 = $this->assignToModel($menu2); |
89 | 93 | if($menus3 = $this->loadData($menu2->id)) { |
90 | 94 | $sub2 = []; |
91 | 95 | foreach ($menus3 as $menu3) { |
92 | 96 | |
93 | - if($withPrivilege && !$this->checkPrivilege($roles_id, $menu3)) continue; |
|
97 | + if($withPrivilege && !$this->checkPrivilege($roles_id, $menu3)) { |
|
98 | + continue; |
|
99 | + } |
|
94 | 100 | |
95 | 101 | $sidebarModel3 = $this->assignToModel($menu3); |
96 | 102 | $sub2[] = $sidebarModel3; |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | { |
19 | 19 | |
20 | 20 | public function getRoleByName($roleName) { |
21 | - return $this->find("cb_roles",['name'=>$roleName]); |
|
21 | + return $this->find("cb_roles", ['name'=>$roleName]); |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | public function fcm() { |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | } |
35 | 35 | |
36 | 36 | public function getDeveloperUrl($path = null) { |
37 | - $path = ($path)?"/".trim($path,"/"):null; |
|
37 | + $path = ($path) ? "/".trim($path, "/") : null; |
|
38 | 38 | return url(cbConfig("DEV_PATH")).$path; |
39 | 39 | } |
40 | 40 | |
@@ -51,22 +51,22 @@ discard block |
||
51 | 51 | } |
52 | 52 | |
53 | 53 | public function getAdminUrl($path = null) { |
54 | - $path = ($path)?"/".trim($path,"/"):null; |
|
54 | + $path = ($path) ? "/".trim($path, "/") : null; |
|
55 | 55 | return url(cbConfig("ADMIN_PATH")).$path; |
56 | 56 | } |
57 | 57 | |
58 | 58 | public function getAppName() { |
59 | - return env("APP_NAME","CRUDBOOSTER"); |
|
59 | + return env("APP_NAME", "CRUDBOOSTER"); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | public function uploadBase64($value) |
63 | 63 | { |
64 | 64 | $fileData = base64_decode($value); |
65 | 65 | $mime_type = finfo_buffer(finfo_open(), $fileData, FILEINFO_MIME_TYPE); |
66 | - if($mime_type) { |
|
67 | - if($mime_type = explode('/', $mime_type)) { |
|
66 | + if ($mime_type) { |
|
67 | + if ($mime_type = explode('/', $mime_type)) { |
|
68 | 68 | $ext = $mime_type[1]; |
69 | - if($ext) { |
|
69 | + if ($ext) { |
|
70 | 70 | $filePath = 'uploads/'.date('Y-m'); |
71 | 71 | Storage::makeDirectory($filePath); |
72 | 72 | $filename = sha1(strRandom(5)).'.'.$ext; |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | |
87 | 87 | $file = request()->file($name); |
88 | 88 | $ext = $file->getClientOriginalExtension(); |
89 | - if(in_array($ext,cbConfig("UPLOAD_FILE_EXTENSION_ALLOWED"))) { |
|
89 | + if (in_array($ext, cbConfig("UPLOAD_FILE_EXTENSION_ALLOWED"))) { |
|
90 | 90 | $filename = slug(pathinfo($file->getClientOriginalName(), PATHINFO_FILENAME)); |
91 | 91 | $file_path = 'uploads/'.date('Y-m'); |
92 | 92 | |
@@ -100,14 +100,14 @@ discard block |
||
100 | 100 | } |
101 | 101 | |
102 | 102 | if (Storage::putFileAs($file_path, $file, $filename)) { |
103 | - if($resize_width || $resize_height) { |
|
103 | + if ($resize_width || $resize_height) { |
|
104 | 104 | $this->resizeImage($file_path.'/'.$filename, $resize_width, $resize_height); |
105 | 105 | } |
106 | 106 | return $file_path.'/'.$filename; |
107 | 107 | } else { |
108 | 108 | throw new \Exception("Something went wrong, file can't upload!"); |
109 | 109 | } |
110 | - }else{ |
|
110 | + } else { |
|
111 | 111 | throw new \Exception("The file format is not allowed!"); |
112 | 112 | } |
113 | 113 | |
@@ -130,22 +130,22 @@ discard block |
||
130 | 130 | $img = Image::make(storage_path('app/'.$file_path.'/'.$filename)); |
131 | 131 | $img->fit($resize_width, $resize_height); |
132 | 132 | $img->save(storage_path('app/'.$file_path.'/'.$filename), $qty); |
133 | - } elseif ($resize_width && ! $resize_height) { |
|
133 | + } elseif ($resize_width && !$resize_height) { |
|
134 | 134 | $img = Image::make(storage_path('app/'.$file_path.'/'.$filename)); |
135 | - $img->resize($resize_width, null, function ($constraint) { |
|
135 | + $img->resize($resize_width, null, function($constraint) { |
|
136 | 136 | $constraint->aspectRatio(); |
137 | 137 | }); |
138 | 138 | $img->save(storage_path('app/'.$file_path.'/'.$filename), $qty); |
139 | - } elseif (! $resize_width && $resize_height) { |
|
139 | + } elseif (!$resize_width && $resize_height) { |
|
140 | 140 | $img = Image::make(storage_path('app/'.$file_path.'/'.$filename)); |
141 | - $img->resize(null, $resize_height, function ($constraint) { |
|
141 | + $img->resize(null, $resize_height, function($constraint) { |
|
142 | 142 | $constraint->aspectRatio(); |
143 | 143 | }); |
144 | 144 | $img->save(storage_path('app/'.$file_path.'/'.$filename), $qty); |
145 | 145 | } else { |
146 | 146 | $img = Image::make(storage_path('app/'.$file_path.'/'.$filename)); |
147 | 147 | if ($img->width() > 1300) { |
148 | - $img->resize(1300, null, function ($constraint) { |
|
148 | + $img->resize(1300, null, function($constraint) { |
|
149 | 149 | $constraint->aspectRatio(); |
150 | 150 | }); |
151 | 151 | } |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | $validator = Validator::make($input_arr, $rules, $messages); |
253 | 253 | if ($validator->fails()) { |
254 | 254 | $message = $validator->errors()->all(); |
255 | - throw new CBValidationException(implode("; ",$message)); |
|
255 | + throw new CBValidationException(implode("; ", $message)); |
|
256 | 256 | } |
257 | 257 | } |
258 | 258 | |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | public function findPrimaryKey($table) |
265 | 265 | { |
266 | 266 | $pk = DB::getDoctrineSchemaManager()->listTableDetails($table)->getPrimaryKey(); |
267 | - if(!$pk) { |
|
267 | + if (!$pk) { |
|
268 | 268 | return null; |
269 | 269 | } |
270 | 270 | return $pk->getColumns()[0]; |
@@ -328,16 +328,16 @@ discard block |
||
328 | 328 | |
329 | 329 | |
330 | 330 | public function routeGet($prefix, $controller) { |
331 | - $alias = str_replace("@"," ", $controller); |
|
331 | + $alias = str_replace("@", " ", $controller); |
|
332 | 332 | $alias = ucwords($alias); |
333 | - $alias = str_replace(" ","",$alias); |
|
333 | + $alias = str_replace(" ", "", $alias); |
|
334 | 334 | Route::get($prefix, ['uses' => $controller, 'as' => $alias]); |
335 | 335 | } |
336 | 336 | |
337 | 337 | public function routePost($prefix, $controller) { |
338 | - $alias = str_replace("@"," ", $controller); |
|
338 | + $alias = str_replace("@", " ", $controller); |
|
339 | 339 | $alias = ucwords($alias); |
340 | - $alias = str_replace(" ","",$alias); |
|
340 | + $alias = str_replace(" ", "", $alias); |
|
341 | 341 | Route::post($prefix, ['uses' => $controller, 'as' => $alias]); |
342 | 342 | } |
343 | 343 |
@@ -20,9 +20,9 @@ |
||
20 | 20 | */ |
21 | 21 | public function indexRender($row, $column) |
22 | 22 | { |
23 | - if($column->getFormat()) { |
|
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 | } |
@@ -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 | } |