Przeglądaj źródła

inserimento rata - fix selezione mesi

ferrari 3 miesięcy temu
rodzic
commit
9755091e97
1 zmienionych plików z 5 dodań i 10 usunięć
  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('*')->where('enabled', true)->get();
@@ -264,17 +263,13 @@ class Rate extends Component
 
     public function addDeleteMonth($m)
     {
-        if (!in_array($m, $this->months))
-        {
+        if (!in_array($m, $this->months)) {
             $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);
             }
         }
     }
-
 }