ferrari 1 mese fa
parent
commit
31cc4166b5
2 ha cambiato i file con 4 aggiunte e 4 eliminazioni
  1. 2 2
      app/Console/Commands/SendSms.php
  2. 2 2
      routes/web.php

+ 2 - 2
app/Console/Commands/SendSms.php

@@ -32,7 +32,7 @@ class SendSms extends Command
         $expire_date_it = date("d/m/Y", strtotime("+1 month"));
         $expire_date_it = date("d/m/Y", strtotime("+1 month"));
         $certificates = \App\Models\MemberCertificate::where('expire_date', $expire_date)->get();
         $certificates = \App\Models\MemberCertificate::where('expire_date', $expire_date)->get();
         foreach ($certificates as $certificate) {            
         foreach ($certificates as $certificate) {            
-            $new = \App\Models\MemberCertificate::where('expire_date', '>', $expire_date)->count();
+            $new = \App\Models\MemberCertificate::where('expire_date', '>', $expire_date)->where('member_id', $certificate->member_id)->count();
             if ($new == 0)
             if ($new == 0)
             {
             {
                 $phone = $certificate->member->phone;
                 $phone = $certificate->member->phone;
@@ -51,7 +51,7 @@ class SendSms extends Command
         $expire_date_it = date("d/m/Y", strtotime("+15 days"));
         $expire_date_it = date("d/m/Y", strtotime("+15 days"));
         $certificates = \App\Models\MemberCertificate::where('expire_date', $expire_date)->get();
         $certificates = \App\Models\MemberCertificate::where('expire_date', $expire_date)->get();
         foreach ($certificates as $certificate) {
         foreach ($certificates as $certificate) {
-            $new = \App\Models\MemberCertificate::where('expire_date', '>', $expire_date)->count();
+            $new = \App\Models\MemberCertificate::where('expire_date', '>', $expire_date)->where('member_id', $certificate->member_id)->count();
             if ($new == 0)
             if ($new == 0)
             {
             {
                 $phone = $certificate->member->phone;
                 $phone = $certificate->member->phone;

+ 2 - 2
routes/web.php

@@ -1761,7 +1761,7 @@ Route::get('/send_sms', function () {
     $expire_date_it = date("d/m/Y", strtotime("+1 month"));
     $expire_date_it = date("d/m/Y", strtotime("+1 month"));
     $certificates = \App\Models\MemberCertificate::where('expire_date', $expire_date)->get();
     $certificates = \App\Models\MemberCertificate::where('expire_date', $expire_date)->get();
     foreach ($certificates as $certificate) {
     foreach ($certificates as $certificate) {
-        $new = \App\Models\MemberCertificate::where('expire_date', '>', $expire_date)->count();
+        $new = \App\Models\MemberCertificate::where('expire_date', '>', $expire_date)->where('member_id', $certificate->member_id)->count();
         if ($new == 0)
         if ($new == 0)
         {
         {
             $phone = $certificate->member->phone;
             $phone = $certificate->member->phone;
@@ -1783,7 +1783,7 @@ Route::get('/send_sms', function () {
     $expire_date_it = date("d/m/Y", strtotime("+15 days"));
     $expire_date_it = date("d/m/Y", strtotime("+15 days"));
     $certificates = \App\Models\MemberCertificate::where('expire_date', $expire_date)->get();
     $certificates = \App\Models\MemberCertificate::where('expire_date', $expire_date)->get();
     foreach ($certificates as $certificate) {
     foreach ($certificates as $certificate) {
-        $new = \App\Models\MemberCertificate::where('expire_date', '>', $expire_date)->count();
+        $new = \App\Models\MemberCertificate::where('expire_date', '>', $expire_date)->where('member_id', $certificate->member_id)->count();
         if ($new == 0)
         if ($new == 0)
         {
         {
             $phone = $certificate->member->phone;
             $phone = $certificate->member->phone;