Преглед изворни кода

inserimento rata - fix selezione mesi

ferrari пре 3 месеци
родитељ
комит
9755091e97
1 измењених фајлова са 5 додато и 10 уклоњено
  1. 5 10
      app/Http/Livewire/Rate.php

+ 5 - 10
app/Http/Livewire/Rate.php

@@ -89,7 +89,6 @@ class Rate extends Component
             }
             }
 
 
             $this->course_subscriptions = \App\Models\CourseSubscription::select('*')->whereIn('id', $course_subscription_ids)->where('enabled', true)->get();
             $this->course_subscriptions = \App\Models\CourseSubscription::select('*')->whereIn('id', $course_subscription_ids)->where('enabled', true)->get();
-
         }
         }
 
 
         //$this->course_subscriptions = \App\Models\CourseSubscription::select('*')->where('enabled', true)->get();
         //$this->course_subscriptions = \App\Models\CourseSubscription::select('*')->where('enabled', true)->get();
@@ -264,17 +263,13 @@ class Rate extends Component
 
 
     public function addDeleteMonth($m)
     public function addDeleteMonth($m)
     {
     {
-        if (!in_array($m, $this->months))
-        {
+        if (!in_array($m, $this->months)) {
             $this->months[] = $m;
             $this->months[] = $m;
-        }
-        else
-        {
-            if (($key = array_search($m, $this->months)) !== false)
-            {
-                $this->months = array_slice($this->months, $key, 1);
+        } else {
+            if (($key = array_search($m, $this->months)) !== false) {
+                unset($this->months[$key]);
+                $this->months = array_values($this->months);
             }
             }
         }
         }
     }
     }
-
 }
 }