Completed
Push — master ( 7600db...19fbd6 )
by Jan
03:21 queued 01:28
created
app/Http/Controllers/Admin/AdminModuleController.php 1 patch
Spacing   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
      *
154 154
      * @param $request
155 155
      */
156
-    protected function afterStore($request, $model){
156
+    protected function afterStore($request, $model) {
157 157
 
158 158
     }
159 159
 
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
      *
163 163
      * @param $request
164 164
      */
165
-    protected function afterUpdate($request, $model){
165
+    protected function afterUpdate($request, $model) {
166 166
 
167 167
     }
168 168
 
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
      * @param $amount
176 176
      */
177 177
     protected function _saveTransation($status_id = 1, $user_id, $amount,
178
-                                       $campaign_id = null, $payment_id = null, $recommendation_id = null){
178
+                                       $campaign_id = null, $payment_id = null, $recommendation_id = null) {
179 179
 
180 180
         /**
181 181
          * Save transaction
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
      * @param boolean $update
206 206
      * @return boolean
207 207
      */
208
-    public function saveMediaToStorage($object, $request, $update = FALSE){
208
+    public function saveMediaToStorage($object, $request, $update = FALSE) {
209 209
         
210 210
         return FALSE;
211 211
     }
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
 
222 222
             return env('ADMIN_PAGINATE', 10);
223 223
         }
224
-        else{
224
+        else {
225 225
 
226 226
             return $this->paginateRows;
227 227
         }
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
      * @param object $object
234 234
      * @param Request $request
235 235
      */
236
-    public function associateRelationships($object, Request $request){
236
+    public function associateRelationships($object, Request $request) {
237 237
         
238 238
     }
239 239
     
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
      * @param object $object
244 244
      * @param Request $request
245 245
      */
246
-    public function associateRelationshipsWithID($object, Request $request){
246
+    public function associateRelationshipsWithID($object, Request $request) {
247 247
         
248 248
     }
249 249
 
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
      * 
253 253
      * @param object $object
254 254
      */
255
-    public function resetCache($object){
255
+    public function resetCache($object) {
256 256
         
257 257
     }
258 258
 
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
      * @param $arResult
263 263
      * @return mixed
264 264
      */
265
-    public function changeEditResultField($arResult){
265
+    public function changeEditResultField($arResult) {
266 266
         return $arResult;
267 267
     }
268 268
 
@@ -297,10 +297,10 @@  discard block
 block discarded – undo
297 297
         /**
298 298
          * Get media
299 299
          */
300
-        if(method_exists($arResults, 'getMedia')){
300
+        if (method_exists($arResults, 'getMedia')) {
301 301
             $media = $arResults->getMedia();
302 302
         }
303
-        else{
303
+        else {
304 304
             $media = null;
305 305
         }
306 306
         
@@ -308,17 +308,17 @@  discard block
 block discarded – undo
308 308
         /**
309 309
          * Choose the view
310 310
          */
311
-        if(empty($this->customView['index']) == TRUE){
311
+        if (empty($this->customView[ 'index' ]) == TRUE) {
312 312
             $view = $this->moduleBasicTemplatePath . '.index';
313 313
         }
314
-        else{
314
+        else {
315 315
             $view = $this->customView;
316 316
         }
317 317
 
318 318
         /**
319 319
          * Return page
320 320
          */
321
-        return view($view, ['results' => $arResults, 'media' => $media]);
321
+        return view($view, [ 'results' => $arResults, 'media' => $media ]);
322 322
     }
323 323
 
324 324
     /**
@@ -331,10 +331,10 @@  discard block
 block discarded – undo
331 331
         /**
332 332
          * Choose the view
333 333
          */
334
-        if(empty($this->customView['index']) == TRUE){
334
+        if (empty($this->customView[ 'index' ]) == TRUE) {
335 335
             $view = $this->moduleBasicTemplatePath . '.create_edit';
336 336
         }
337
-        else{
337
+        else {
338 338
             $view = $this->customView;
339 339
         }
340 340
         
@@ -356,8 +356,8 @@  discard block
 block discarded – undo
356 356
          * Change the validation array
357 357
          */
358 358
         foreach ($this->arValidationArray as $name => $value) {
359
-            if(strpos($this->arValidationArray[$name], 'unique') > 0){
360
-                $this->arValidationArray[$name] = $value . ',NULL,id,deleted_at,NULL';
359
+            if (strpos($this->arValidationArray[ $name ], 'unique') > 0) {
360
+                $this->arValidationArray[ $name ] = $value . ',NULL,id,deleted_at,NULL';
361 361
             }
362 362
         }
363 363
 
@@ -380,16 +380,16 @@  discard block
 block discarded – undo
380 380
             /**
381 381
              * Datetime
382 382
              */
383
-            if(in_array($name, $this->dateTimeLocalFields)){
383
+            if (in_array($name, $this->dateTimeLocalFields)) {
384 384
 
385
-                $object->{$name} = str_replace('T', ' ', $request->input($name)). ':00';
385
+                $object->{$name} = str_replace('T', ' ', $request->input($name)) . ':00';
386 386
             }
387 387
             else {
388 388
 
389 389
                 /**
390 390
                  * Change to null if needed
391 391
                  */
392
-                if(strlen($request->$name) < 1){
392
+                if (strlen($request->$name) < 1) {
393 393
                     $object->{$name} = null;
394 394
                 }
395 395
                 else {
@@ -428,7 +428,7 @@  discard block
 block discarded – undo
428 428
         /**
429 429
          * Redirect to index
430 430
          */
431
-        if(!empty($request->custom_route)){
431
+        if (!empty($request->custom_route)) {
432 432
             return redirect($request->custom_route);
433 433
         }
434 434
         else {
@@ -457,21 +457,21 @@  discard block
 block discarded – undo
457 457
          */
458 458
         if (empty($arResults)) {
459 459
 
460
-            return redirect(route($this->moduleBasicRoute . '.index'))->withInput()->withErrors(['edit' => trans('validation.row_not_exist')]);
460
+            return redirect(route($this->moduleBasicRoute . '.index'))->withInput()->withErrors([ 'edit' => trans('validation.row_not_exist') ]);
461 461
         }
462 462
 
463 463
         /**
464 464
          * Set the put method for update
465 465
          */
466
-        $arResults['_method'] = 'PUT';
466
+        $arResults[ '_method' ] = 'PUT';
467 467
         
468 468
         /**
469 469
          * Choose the view
470 470
          */
471
-        if(empty($this->customView['index']) == TRUE){
471
+        if (empty($this->customView[ 'index' ]) == TRUE) {
472 472
             $view = $this->moduleBasicTemplatePath . '.create_edit';
473 473
         }
474
-        else{
474
+        else {
475 475
             $view = $this->customView;
476 476
         }
477 477
 
@@ -480,7 +480,7 @@  discard block
 block discarded – undo
480 480
         /**
481 481
          * Return page
482 482
          */
483
-        return view($view, ['results' => $arResults]);
483
+        return view($view, [ 'results' => $arResults ]);
484 484
     }
485 485
 
486 486
     /**
@@ -508,8 +508,8 @@  discard block
 block discarded – undo
508 508
          */
509 509
         foreach ($this->arValidationArray as $name => $value) {
510 510
             
511
-            if(strpos($this->arValidationArray[$name], 'unique') > 0){
512
-                $this->arValidationArray[$name] = $value . ','.$id.',id,deleted_at,NULL';
511
+            if (strpos($this->arValidationArray[ $name ], 'unique') > 0) {
512
+                $this->arValidationArray[ $name ] = $value . ',' . $id . ',id,deleted_at,NULL';
513 513
             }
514 514
         }
515 515
 
@@ -529,7 +529,7 @@  discard block
 block discarded – undo
529 529
          */
530 530
         if ($arResults == FALSE) {
531 531
 
532
-            return redirect(route($this->moduleBasicRoute . '.index'))->withInput()->withErrors(['edit' => trans('validation.row_not_exist')]);
532
+            return redirect(route($this->moduleBasicRoute . '.index'))->withInput()->withErrors([ 'edit' => trans('validation.row_not_exist') ]);
533 533
         }
534 534
         
535 535
         /**
@@ -546,10 +546,10 @@  discard block
 block discarded – undo
546 546
              * Binary fields will not be updated if empty
547 547
              *
548 548
              */
549
-            if(in_array($name, $this->binaryFields)){
549
+            if (in_array($name, $this->binaryFields)) {
550 550
 
551 551
             }
552
-            else{
552
+            else {
553 553
                 
554 554
                /**
555 555
                 * Empty exception
@@ -559,26 +559,26 @@  discard block
 block discarded – undo
559 559
                    /**
560 560
                     * Datetime
561 561
                     */
562
-                   if(in_array($name, $this->dateTimeLocalFields)){
562
+                   if (in_array($name, $this->dateTimeLocalFields)) {
563 563
 
564
-                       $arResults->$name = str_replace('T', ' ', $request->input($name)). ':00';
564
+                       $arResults->$name = str_replace('T', ' ', $request->input($name)) . ':00';
565 565
                    }
566 566
                    else {
567 567
                        $arResults->$name = $request->input($name);
568 568
                    }
569 569
                }
570 570
                
571
-               else{
571
+               else {
572 572
                    
573 573
                    /**
574 574
                     * Numeric zero ?
575 575
                     */
576
-                   if(isset($request->$name) && is_numeric($request->input($name)) == TRUE){
576
+                   if (isset($request->$name) && is_numeric($request->input($name)) == TRUE) {
577 577
                        
578 578
                       $arResults->$name = $request->input($name);
579 579
                    }
580 580
                    
581
-                   else{
581
+                   else {
582 582
                     $arResults->$name = NULL;
583 583
                    }
584 584
                }
@@ -596,7 +596,7 @@  discard block
 block discarded – undo
596 596
         /**
597 597
          * Save media to storage
598 598
          */
599
-        if($this->saveMediaToStorage($arResults, $request, TRUE) == TRUE){
599
+        if ($this->saveMediaToStorage($arResults, $request, TRUE) == TRUE) {
600 600
             
601 601
             // Update binary fields
602 602
             foreach ($this->binaryFields as $name => $value) {
@@ -604,7 +604,7 @@  discard block
 block discarded – undo
604 604
                 if (empty($request->$value) == FALSE) {
605 605
                    $arResults->$value = $request->$value;
606 606
                 }
607
-                else{
607
+                else {
608 608
                     $arResults->$value = NULL;
609 609
                 }
610 610
             }
@@ -628,7 +628,7 @@  discard block
 block discarded – undo
628 628
         /**
629 629
          * Redirect to index
630 630
          */
631
-        if(!empty($request->custom_route)){
631
+        if (!empty($request->custom_route)) {
632 632
             return redirect($request->custom_route);
633 633
         }
634 634
         else {
Please login to merge, or discard this patch.