Completed
Push — master ( 4fcfbd...d70fd2 )
by Jan
08:18
created
app/Http/Controllers/Admin/AdminModuleController.php 1 patch
Spacing   +36 added lines, -36 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
 
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
279 279
         /**
280 280
          * Choose the view
281 281
          */
282
-        if(empty($this->customView['index']) == TRUE){
282
+        if (empty($this->customView[ 'index' ]) == TRUE) {
283 283
             $view = $this->moduleBasicTemplatePath . '.index';
284 284
         }
285
-        else{
285
+        else {
286 286
             $view = $this->customView;
287 287
         }
288 288
 
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
         /**
291 291
          * Return page
292 292
          */
293
-        return view($view, ['results' => $arResults]);
293
+        return view($view, [ 'results' => $arResults ]);
294 294
     }
295 295
 
296 296
     /**
@@ -303,10 +303,10 @@  discard block
 block discarded – undo
303 303
         /**
304 304
          * Choose the view
305 305
          */
306
-        if(empty($this->customView['index']) == TRUE){
306
+        if (empty($this->customView[ 'index' ]) == TRUE) {
307 307
             $view = $this->moduleBasicTemplatePath . '.create_edit';
308 308
         }
309
-        else{
309
+        else {
310 310
             $view = $this->customView;
311 311
         }
312 312
         
@@ -328,8 +328,8 @@  discard block
 block discarded – undo
328 328
          * Change the validation array
329 329
          */
330 330
         foreach ($this->arValidationArray as $name => $value) {
331
-            if(strpos($this->arValidationArray[$name], 'unique') > 0){
332
-                $this->arValidationArray[$name] = $value . ',NULL,id,deleted_at,NULL';
331
+            if (strpos($this->arValidationArray[ $name ], 'unique') > 0) {
332
+                $this->arValidationArray[ $name ] = $value . ',NULL,id,deleted_at,NULL';
333 333
             }
334 334
         }
335 335
 
@@ -352,16 +352,16 @@  discard block
 block discarded – undo
352 352
             /**
353 353
              * Datetime
354 354
              */
355
-            if(in_array($name, $this->dateTimeLocalFields)){
355
+            if (in_array($name, $this->dateTimeLocalFields)) {
356 356
 
357
-                $object->{$name} = str_replace('T', ' ', $request->input($name)). ':00';
357
+                $object->{$name} = str_replace('T', ' ', $request->input($name)) . ':00';
358 358
             }
359 359
             else {
360 360
 
361 361
                 /**
362 362
                  * Change to null if needed
363 363
                  */
364
-                if(strlen($request->$name) < 1){
364
+                if (strlen($request->$name) < 1) {
365 365
                     $object->{$name} = null;
366 366
                 }
367 367
                 else {
@@ -419,21 +419,21 @@  discard block
 block discarded – undo
419 419
          */
420 420
         if (empty($arResults)) {
421 421
 
422
-            return redirect(route($this->moduleBasicRoute . '.index'))->withInput()->withErrors(['edit' => trans('validation.row_not_exist')]);
422
+            return redirect(route($this->moduleBasicRoute . '.index'))->withInput()->withErrors([ 'edit' => trans('validation.row_not_exist') ]);
423 423
         }
424 424
 
425 425
         /**
426 426
          * Set the put method for update
427 427
          */
428
-        $arResults['_method'] = 'PUT';
428
+        $arResults[ '_method' ] = 'PUT';
429 429
         
430 430
         /**
431 431
          * Choose the view
432 432
          */
433
-        if(empty($this->customView['index']) == TRUE){
433
+        if (empty($this->customView[ 'index' ]) == TRUE) {
434 434
             $view = $this->moduleBasicTemplatePath . '.create_edit';
435 435
         }
436
-        else{
436
+        else {
437 437
             $view = $this->customView;
438 438
         }
439 439
 
@@ -442,7 +442,7 @@  discard block
 block discarded – undo
442 442
         /**
443 443
          * Return page
444 444
          */
445
-        return view($view, ['results' => $arResults]);
445
+        return view($view, [ 'results' => $arResults ]);
446 446
     }
447 447
 
448 448
     /**
@@ -470,8 +470,8 @@  discard block
 block discarded – undo
470 470
          */
471 471
         foreach ($this->arValidationArray as $name => $value) {
472 472
             
473
-            if(strpos($this->arValidationArray[$name], 'unique') > 0){
474
-                $this->arValidationArray[$name] = $value . ','.$id.',id,deleted_at,NULL';
473
+            if (strpos($this->arValidationArray[ $name ], 'unique') > 0) {
474
+                $this->arValidationArray[ $name ] = $value . ',' . $id . ',id,deleted_at,NULL';
475 475
             }
476 476
         }
477 477
 
@@ -491,7 +491,7 @@  discard block
 block discarded – undo
491 491
          */
492 492
         if ($arResults == FALSE) {
493 493
 
494
-            return redirect(route($this->moduleBasicRoute . '.index'))->withInput()->withErrors(['edit' => trans('validation.row_not_exist')]);
494
+            return redirect(route($this->moduleBasicRoute . '.index'))->withInput()->withErrors([ 'edit' => trans('validation.row_not_exist') ]);
495 495
         }
496 496
         
497 497
         /**
@@ -508,10 +508,10 @@  discard block
 block discarded – undo
508 508
              * Binary fields will not be updated if empty
509 509
              *
510 510
              */
511
-            if(in_array($name, $this->binaryFields)){
511
+            if (in_array($name, $this->binaryFields)) {
512 512
 
513 513
             }
514
-            else{
514
+            else {
515 515
                 
516 516
                /**
517 517
                 * Empty exception
@@ -521,26 +521,26 @@  discard block
 block discarded – undo
521 521
                    /**
522 522
                     * Datetime
523 523
                     */
524
-                   if(in_array($name, $this->dateTimeLocalFields)){
524
+                   if (in_array($name, $this->dateTimeLocalFields)) {
525 525
 
526
-                       $arResults->$name = str_replace('T', ' ', $request->input($name)). ':00';
526
+                       $arResults->$name = str_replace('T', ' ', $request->input($name)) . ':00';
527 527
                    }
528 528
                    else {
529 529
                        $arResults->$name = $request->input($name);
530 530
                    }
531 531
                }
532 532
                
533
-               else{
533
+               else {
534 534
                    
535 535
                    /**
536 536
                     * Numeric zero ?
537 537
                     */
538
-                   if(isset($request->name) && is_numeric($request->input($name)) == TRUE){
538
+                   if (isset($request->name) && is_numeric($request->input($name)) == TRUE) {
539 539
                        
540 540
                       $arResults->$name = $request->input($name);
541 541
                    }
542 542
                    
543
-                   else{
543
+                   else {
544 544
                     $arResults->$name = NULL;
545 545
                    }
546 546
                }
@@ -558,7 +558,7 @@  discard block
 block discarded – undo
558 558
         /**
559 559
          * Save media to storage
560 560
          */
561
-        if($this->saveMediaToStorage($arResults, $request, TRUE) == TRUE){
561
+        if ($this->saveMediaToStorage($arResults, $request, TRUE) == TRUE) {
562 562
             
563 563
             // Update binary fields
564 564
             foreach ($this->binaryFields as $name => $value) {
@@ -566,7 +566,7 @@  discard block
 block discarded – undo
566 566
                 if (empty($request->$value) == FALSE) {
567 567
                    $arResults->$value = $request->$value;
568 568
                 }
569
-                else{
569
+                else {
570 570
                     $arResults->$value = NULL;
571 571
                 }
572 572
             }
Please login to merge, or discard this patch.