EVOLUTION-NINJA
Edit File: FollowUpModel.php
<?php namespace App\Models; use CodeIgniter\Model; class FollowUpModel extends Model { protected $table = 'follow_up'; protected $primaryKey = 'id'; protected $allowedFields = ['id','leads_id', 'follow_up_remarks', 'follow_by','today_date','today_time','next_date']; // public function getFollowUpData() // { // // Use $this->findAll() to retrieve all records from the table // return $this->findAll(); // } // public function updateFollowUp($updateFollowUpId, $data) // { // try { // $this->where('leads_id', $updateFollowUpId); // if ($this->update($updateFollowUpId, $data)) { // return true; // } else { // return false; // } // } catch (\Throwable $th) { // log_message('error', 'Error updating follow-up: ' . $th->getMessage()); // return false; // } // } public function updateFollowup($id, $data) { return $this->where('id', $id)->set($data)->update(); } public function deleteFollowup($id) { return $this->delete($id); } // public function getFollowUpData() // { // return $this->select('follow_up.follow_up_remarks, follow_up.follow_by, leads.id') // ->join('leads', 'leads.id = follow_up.leads_id') // ->findAll(); // } public function getFollowUpData($id) { // echo $id;die(); $builder = $this->db->table($this->table); $builder=$this->where('leads_id', $id); $data= $this->findAll(); // $lq=$this->db->getLastQuery(); // echo $lq;die(); // print_r($data);die(); return $data; } public function getFollowUpDatafollow($id) { // echo $id;die(); $builder = $this->db->table($this->table); $builder=$this->where('id', $id); $data= $this->findAll(); // $lq=$this->db->getLastQuery(); // echo $lq;die(); // print_r($data);die(); return $data; } public function getLeadId($followUpId) { $followUp = $this->find($followUpId); if ($followUp) { return $followUp['leads_id']; } return null; } }