From 3b7fd97f3e67d72b7c1afc12c68f8696c75de250 Mon Sep 17 00:00:00 2001 From: Srinivas-Saravanan Date: Mon, 18 Nov 2024 16:37:59 +0530 Subject: [PATCH] FEATURE_SET_EXPIRED_CUSTOMERS --- app/Controllers/Notifications.php | 15 ++++++++++++++- app/Models/SubscriptionModel.php | 2 +- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/app/Controllers/Notifications.php b/app/Controllers/Notifications.php index 72fc4225..8483ad9c 100755 --- a/app/Controllers/Notifications.php +++ b/app/Controllers/Notifications.php @@ -4,6 +4,7 @@ namespace App\Controllers; use App\Helpers\NotificationHelper; use App\Models\NotificationModel; +use App\Models\SubscriptionModel; class Notifications extends BaseController { @@ -570,6 +571,7 @@ class Notifications extends BaseController ################################################################ public function getExpCustomerDetail($window_time = null) { + $this->update_expired_members(); echo "Hi, "; # Step 1: add the days to retrive the data// $providedDate = date('Y-m-d'); @@ -799,13 +801,24 @@ class Notifications extends BaseController # EXPIRAY_NOTIFY_TEMPLATE_WHATSAPP Closed } else{ - $this->logger->error("statsu is draft"); + $this->logger->error("status is draft"); } # Loop Closed echo "Process Completed
"; } + } + + public function update_expired_members() + { + $model = new SubscriptionModel(); + $currentDate = date('Y-m-d'); + $model->where('to_subscription <', $currentDate) + ->set(['status' => 0]) + ->update(); + log_message('info','inside the update function'); + } # getExpCustomerDetail fns Closed ################################################################ diff --git a/app/Models/SubscriptionModel.php b/app/Models/SubscriptionModel.php index 955f8ea9..08ae554f 100755 --- a/app/Models/SubscriptionModel.php +++ b/app/Models/SubscriptionModel.php @@ -7,7 +7,7 @@ class SubscriptionModel extends Model { protected $table = 'subscription'; protected $primaryKey = 'sub_id'; -protected $allowedFields = ['sub_id','scheme_id','customer_id','to_subscription','from_subscription','mode','created_on','created_by','updated_by','updated_on','business_id']; +protected $allowedFields = ['sub_id','scheme_id','customer_id','to_subscription','from_subscription','mode','created_on','created_by','updated_by','updated_on','business_id','status'];