@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | use App\Transaction; |
26 | 26 | use App\User; |
27 | 27 | |
28 | -class AdminModuleController extends Controller{ |
|
28 | +class AdminModuleController extends Controller { |
|
29 | 29 | |
30 | 30 | /** |
31 | 31 | * Module name |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | * Module name for blade |
145 | 145 | */ |
146 | 146 | $temp = explode('.', $this->moduleBasicRoute); |
147 | - View::share('moduleNameBlade', strtolower($temp[0] . "_module_" . $temp[1])); |
|
147 | + View::share('moduleNameBlade', strtolower($temp[ 0 ] . "_module_" . $temp[ 1 ])); |
|
148 | 148 | |
149 | 149 | } |
150 | 150 | |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | * @param $amount |
158 | 158 | */ |
159 | 159 | protected function _saveTransation($status_id = 1, $user_id, $amount, |
160 | - $campaign_id = null, $payment_id = null, $recommendation_id = null){ |
|
160 | + $campaign_id = null, $payment_id = null, $recommendation_id = null) { |
|
161 | 161 | |
162 | 162 | /** |
163 | 163 | * Save transaction |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | * @param boolean $update |
188 | 188 | * @return boolean |
189 | 189 | */ |
190 | - public function saveMediaToStorage($object, $request, $update = FALSE){ |
|
190 | + public function saveMediaToStorage($object, $request, $update = FALSE) { |
|
191 | 191 | |
192 | 192 | return FALSE; |
193 | 193 | } |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | |
204 | 204 | return env('ADMIN_PAGINATE', 10); |
205 | 205 | } |
206 | - else{ |
|
206 | + else { |
|
207 | 207 | |
208 | 208 | return $this->paginateRows; |
209 | 209 | } |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | * @param object $object |
216 | 216 | * @param Request $request |
217 | 217 | */ |
218 | - public function associateRelationships($object, Request $request){ |
|
218 | + public function associateRelationships($object, Request $request) { |
|
219 | 219 | |
220 | 220 | } |
221 | 221 | |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | * @param object $object |
226 | 226 | * @param Request $request |
227 | 227 | */ |
228 | - public function associateRelationshipsWithID($object, Request $request){ |
|
228 | + public function associateRelationshipsWithID($object, Request $request) { |
|
229 | 229 | |
230 | 230 | } |
231 | 231 | |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | * |
235 | 235 | * @param object $object |
236 | 236 | */ |
237 | - public function resetCache($object){ |
|
237 | + public function resetCache($object) { |
|
238 | 238 | |
239 | 239 | } |
240 | 240 | |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | * @param $arResult |
245 | 245 | * @return mixed |
246 | 246 | */ |
247 | - public function changeEditResultField($arResult){ |
|
247 | + public function changeEditResultField($arResult) { |
|
248 | 248 | return $arResult; |
249 | 249 | } |
250 | 250 | |
@@ -279,10 +279,10 @@ discard block |
||
279 | 279 | /** |
280 | 280 | * Get media |
281 | 281 | */ |
282 | - if(method_exists($arResults, 'getMedia')){ |
|
282 | + if (method_exists($arResults, 'getMedia')) { |
|
283 | 283 | $media = $arResults->getMedia(); |
284 | 284 | } |
285 | - else{ |
|
285 | + else { |
|
286 | 286 | $media = null; |
287 | 287 | } |
288 | 288 | |
@@ -290,17 +290,17 @@ discard block |
||
290 | 290 | /** |
291 | 291 | * Choose the view |
292 | 292 | */ |
293 | - if(empty($this->customView['index']) == TRUE){ |
|
293 | + if (empty($this->customView[ 'index' ]) == TRUE) { |
|
294 | 294 | $view = $this->moduleBasicTemplatePath . '.index'; |
295 | 295 | } |
296 | - else{ |
|
296 | + else { |
|
297 | 297 | $view = $this->customView; |
298 | 298 | } |
299 | 299 | |
300 | 300 | /** |
301 | 301 | * Return page |
302 | 302 | */ |
303 | - return view($view, ['results' => $arResults, 'media' => $media]); |
|
303 | + return view($view, [ 'results' => $arResults, 'media' => $media ]); |
|
304 | 304 | } |
305 | 305 | |
306 | 306 | /** |
@@ -313,10 +313,10 @@ discard block |
||
313 | 313 | /** |
314 | 314 | * Choose the view |
315 | 315 | */ |
316 | - if(empty($this->customView['index']) == TRUE){ |
|
316 | + if (empty($this->customView[ 'index' ]) == TRUE) { |
|
317 | 317 | $view = $this->moduleBasicTemplatePath . '.create_edit'; |
318 | 318 | } |
319 | - else{ |
|
319 | + else { |
|
320 | 320 | $view = $this->customView; |
321 | 321 | } |
322 | 322 | |
@@ -338,8 +338,8 @@ discard block |
||
338 | 338 | * Change the validation array |
339 | 339 | */ |
340 | 340 | foreach ($this->arValidationArray as $name => $value) { |
341 | - if(strpos($this->arValidationArray[$name], 'unique') > 0){ |
|
342 | - $this->arValidationArray[$name] = $value . ',NULL,id,deleted_at,NULL'; |
|
341 | + if (strpos($this->arValidationArray[ $name ], 'unique') > 0) { |
|
342 | + $this->arValidationArray[ $name ] = $value . ',NULL,id,deleted_at,NULL'; |
|
343 | 343 | } |
344 | 344 | } |
345 | 345 | |
@@ -362,16 +362,16 @@ discard block |
||
362 | 362 | /** |
363 | 363 | * Datetime |
364 | 364 | */ |
365 | - if(in_array($name, $this->dateTimeLocalFields)){ |
|
365 | + if (in_array($name, $this->dateTimeLocalFields)) { |
|
366 | 366 | |
367 | - $object->{$name} = str_replace('T', ' ', $request->input($name)). ':00'; |
|
367 | + $object->{$name} = str_replace('T', ' ', $request->input($name)) . ':00'; |
|
368 | 368 | } |
369 | 369 | else { |
370 | 370 | |
371 | 371 | /** |
372 | 372 | * Change to null if needed |
373 | 373 | */ |
374 | - if(strlen($request->$name) < 1){ |
|
374 | + if (strlen($request->$name) < 1) { |
|
375 | 375 | $object->{$name} = null; |
376 | 376 | } |
377 | 377 | else { |
@@ -405,7 +405,7 @@ discard block |
||
405 | 405 | /** |
406 | 406 | * Redirect to index |
407 | 407 | */ |
408 | - if(!empty($request->custom_route)){ |
|
408 | + if (!empty($request->custom_route)) { |
|
409 | 409 | return redirect($request->custom_route); |
410 | 410 | } |
411 | 411 | else { |
@@ -434,21 +434,21 @@ discard block |
||
434 | 434 | */ |
435 | 435 | if (empty($arResults)) { |
436 | 436 | |
437 | - return redirect(route($this->moduleBasicRoute . '.index'))->withInput()->withErrors(['edit' => trans('validation.row_not_exist')]); |
|
437 | + return redirect(route($this->moduleBasicRoute . '.index'))->withInput()->withErrors([ 'edit' => trans('validation.row_not_exist') ]); |
|
438 | 438 | } |
439 | 439 | |
440 | 440 | /** |
441 | 441 | * Set the put method for update |
442 | 442 | */ |
443 | - $arResults['_method'] = 'PUT'; |
|
443 | + $arResults[ '_method' ] = 'PUT'; |
|
444 | 444 | |
445 | 445 | /** |
446 | 446 | * Choose the view |
447 | 447 | */ |
448 | - if(empty($this->customView['index']) == TRUE){ |
|
448 | + if (empty($this->customView[ 'index' ]) == TRUE) { |
|
449 | 449 | $view = $this->moduleBasicTemplatePath . '.create_edit'; |
450 | 450 | } |
451 | - else{ |
|
451 | + else { |
|
452 | 452 | $view = $this->customView; |
453 | 453 | } |
454 | 454 | |
@@ -457,7 +457,7 @@ discard block |
||
457 | 457 | /** |
458 | 458 | * Return page |
459 | 459 | */ |
460 | - return view($view, ['results' => $arResults]); |
|
460 | + return view($view, [ 'results' => $arResults ]); |
|
461 | 461 | } |
462 | 462 | |
463 | 463 | /** |
@@ -485,8 +485,8 @@ discard block |
||
485 | 485 | */ |
486 | 486 | foreach ($this->arValidationArray as $name => $value) { |
487 | 487 | |
488 | - if(strpos($this->arValidationArray[$name], 'unique') > 0){ |
|
489 | - $this->arValidationArray[$name] = $value . ','.$id.',id,deleted_at,NULL'; |
|
488 | + if (strpos($this->arValidationArray[ $name ], 'unique') > 0) { |
|
489 | + $this->arValidationArray[ $name ] = $value . ',' . $id . ',id,deleted_at,NULL'; |
|
490 | 490 | } |
491 | 491 | } |
492 | 492 | |
@@ -506,7 +506,7 @@ discard block |
||
506 | 506 | */ |
507 | 507 | if ($arResults == FALSE) { |
508 | 508 | |
509 | - return redirect(route($this->moduleBasicRoute . '.index'))->withInput()->withErrors(['edit' => trans('validation.row_not_exist')]); |
|
509 | + return redirect(route($this->moduleBasicRoute . '.index'))->withInput()->withErrors([ 'edit' => trans('validation.row_not_exist') ]); |
|
510 | 510 | } |
511 | 511 | |
512 | 512 | /** |
@@ -523,10 +523,10 @@ discard block |
||
523 | 523 | * Binary fields will not be updated if empty |
524 | 524 | * |
525 | 525 | */ |
526 | - if(in_array($name, $this->binaryFields)){ |
|
526 | + if (in_array($name, $this->binaryFields)) { |
|
527 | 527 | |
528 | 528 | } |
529 | - else{ |
|
529 | + else { |
|
530 | 530 | |
531 | 531 | /** |
532 | 532 | * Empty exception |
@@ -536,26 +536,26 @@ discard block |
||
536 | 536 | /** |
537 | 537 | * Datetime |
538 | 538 | */ |
539 | - if(in_array($name, $this->dateTimeLocalFields)){ |
|
539 | + if (in_array($name, $this->dateTimeLocalFields)) { |
|
540 | 540 | |
541 | - $arResults->$name = str_replace('T', ' ', $request->input($name)). ':00'; |
|
541 | + $arResults->$name = str_replace('T', ' ', $request->input($name)) . ':00'; |
|
542 | 542 | } |
543 | 543 | else { |
544 | 544 | $arResults->$name = $request->input($name); |
545 | 545 | } |
546 | 546 | } |
547 | 547 | |
548 | - else{ |
|
548 | + else { |
|
549 | 549 | |
550 | 550 | /** |
551 | 551 | * Numeric zero ? |
552 | 552 | */ |
553 | - if(isset($request->$name) && is_numeric($request->input($name)) == TRUE){ |
|
553 | + if (isset($request->$name) && is_numeric($request->input($name)) == TRUE) { |
|
554 | 554 | |
555 | 555 | $arResults->$name = $request->input($name); |
556 | 556 | } |
557 | 557 | |
558 | - else{ |
|
558 | + else { |
|
559 | 559 | $arResults->$name = NULL; |
560 | 560 | } |
561 | 561 | } |
@@ -573,7 +573,7 @@ discard block |
||
573 | 573 | /** |
574 | 574 | * Save media to storage |
575 | 575 | */ |
576 | - if($this->saveMediaToStorage($arResults, $request, TRUE) == TRUE){ |
|
576 | + if ($this->saveMediaToStorage($arResults, $request, TRUE) == TRUE) { |
|
577 | 577 | |
578 | 578 | // Update binary fields |
579 | 579 | foreach ($this->binaryFields as $name => $value) { |
@@ -581,7 +581,7 @@ discard block |
||
581 | 581 | if (empty($request->$value) == FALSE) { |
582 | 582 | $arResults->$value = $request->$value; |
583 | 583 | } |
584 | - else{ |
|
584 | + else { |
|
585 | 585 | $arResults->$value = NULL; |
586 | 586 | } |
587 | 587 | } |
@@ -600,7 +600,7 @@ discard block |
||
600 | 600 | /** |
601 | 601 | * Redirect to index |
602 | 602 | */ |
603 | - if(!empty($request->custom_route)){ |
|
603 | + if (!empty($request->custom_route)) { |
|
604 | 604 | return redirect($request->custom_route); |
605 | 605 | } |
606 | 606 | else { |
@@ -202,8 +202,7 @@ discard block |
||
202 | 202 | if ($this->paginateRows == NULL) { |
203 | 203 | |
204 | 204 | return env('ADMIN_PAGINATE', 10); |
205 | - } |
|
206 | - else{ |
|
205 | + } else{ |
|
207 | 206 | |
208 | 207 | return $this->paginateRows; |
209 | 208 | } |
@@ -281,8 +280,7 @@ discard block |
||
281 | 280 | */ |
282 | 281 | if(method_exists($arResults, 'getMedia')){ |
283 | 282 | $media = $arResults->getMedia(); |
284 | - } |
|
285 | - else{ |
|
283 | + } else{ |
|
286 | 284 | $media = null; |
287 | 285 | } |
288 | 286 | |
@@ -292,8 +290,7 @@ discard block |
||
292 | 290 | */ |
293 | 291 | if(empty($this->customView['index']) == TRUE){ |
294 | 292 | $view = $this->moduleBasicTemplatePath . '.index'; |
295 | - } |
|
296 | - else{ |
|
293 | + } else{ |
|
297 | 294 | $view = $this->customView; |
298 | 295 | } |
299 | 296 | |
@@ -315,8 +312,7 @@ discard block |
||
315 | 312 | */ |
316 | 313 | if(empty($this->customView['index']) == TRUE){ |
317 | 314 | $view = $this->moduleBasicTemplatePath . '.create_edit'; |
318 | - } |
|
319 | - else{ |
|
315 | + } else{ |
|
320 | 316 | $view = $this->customView; |
321 | 317 | } |
322 | 318 | |
@@ -365,16 +361,14 @@ discard block |
||
365 | 361 | if(in_array($name, $this->dateTimeLocalFields)){ |
366 | 362 | |
367 | 363 | $object->{$name} = str_replace('T', ' ', $request->input($name)). ':00'; |
368 | - } |
|
369 | - else { |
|
364 | + } else { |
|
370 | 365 | |
371 | 366 | /** |
372 | 367 | * Change to null if needed |
373 | 368 | */ |
374 | 369 | if(strlen($request->$name) < 1){ |
375 | 370 | $object->{$name} = null; |
376 | - } |
|
377 | - else { |
|
371 | + } else { |
|
378 | 372 | $object->{$name} = $request->input($name); |
379 | 373 | } |
380 | 374 | } |
@@ -407,8 +401,7 @@ discard block |
||
407 | 401 | */ |
408 | 402 | if(!empty($request->custom_route)){ |
409 | 403 | return redirect($request->custom_route); |
410 | - } |
|
411 | - else { |
|
404 | + } else { |
|
412 | 405 | return redirect(route($this->moduleBasicRoute . '.index')); |
413 | 406 | } |
414 | 407 | } |
@@ -447,8 +440,7 @@ discard block |
||
447 | 440 | */ |
448 | 441 | if(empty($this->customView['index']) == TRUE){ |
449 | 442 | $view = $this->moduleBasicTemplatePath . '.create_edit'; |
450 | - } |
|
451 | - else{ |
|
443 | + } else{ |
|
452 | 444 | $view = $this->customView; |
453 | 445 | } |
454 | 446 | |
@@ -525,8 +517,7 @@ discard block |
||
525 | 517 | */ |
526 | 518 | if(in_array($name, $this->binaryFields)){ |
527 | 519 | |
528 | - } |
|
529 | - else{ |
|
520 | + } else{ |
|
530 | 521 | |
531 | 522 | /** |
532 | 523 | * Empty exception |
@@ -539,13 +530,10 @@ discard block |
||
539 | 530 | if(in_array($name, $this->dateTimeLocalFields)){ |
540 | 531 | |
541 | 532 | $arResults->$name = str_replace('T', ' ', $request->input($name)). ':00'; |
542 | - } |
|
543 | - else { |
|
533 | + } else { |
|
544 | 534 | $arResults->$name = $request->input($name); |
545 | 535 | } |
546 | - } |
|
547 | - |
|
548 | - else{ |
|
536 | + } else{ |
|
549 | 537 | |
550 | 538 | /** |
551 | 539 | * Numeric zero ? |
@@ -553,9 +541,7 @@ discard block |
||
553 | 541 | if(isset($request->$name) && is_numeric($request->input($name)) == TRUE){ |
554 | 542 | |
555 | 543 | $arResults->$name = $request->input($name); |
556 | - } |
|
557 | - |
|
558 | - else{ |
|
544 | + } else{ |
|
559 | 545 | $arResults->$name = NULL; |
560 | 546 | } |
561 | 547 | } |
@@ -580,8 +566,7 @@ discard block |
||
580 | 566 | |
581 | 567 | if (empty($request->$value) == FALSE) { |
582 | 568 | $arResults->$value = $request->$value; |
583 | - } |
|
584 | - else{ |
|
569 | + } else{ |
|
585 | 570 | $arResults->$value = NULL; |
586 | 571 | } |
587 | 572 | } |
@@ -602,8 +587,7 @@ discard block |
||
602 | 587 | */ |
603 | 588 | if(!empty($request->custom_route)){ |
604 | 589 | return redirect($request->custom_route); |
605 | - } |
|
606 | - else { |
|
590 | + } else { |
|
607 | 591 | return redirect(route($this->moduleBasicRoute . '.index')); |
608 | 592 | } |
609 | 593 | } |