EVOLUTION-NINJA
Edit File: ConvertModel.php
<?php namespace App\Models; use CodeIgniter\Model; class ConvertModel extends Model { protected $table = 'students_converted'; protected $primaryKey = 'id'; protected $allowedFields = [ 'admission_no', 'leads_id', 'first_name', 'last_name', 'email', 'dob', 'date', 'mobile_no', 'address', 'city', 'course_offered', 'qualification', 'country', 'counselor_name', 'gender', 'source', 'profession', 'status', 'company_name', 'remarks', 'converted_by', 'converted_date', 'total_fees', 'paid_fees', 'created_at', ]; public function getLastAdmissionNumber() { $lastRecord = $this->orderBy('id', 'DESC')->first(); if ($lastRecord) { preg_match('/\d+/', $lastRecord['admission_no'], $matches); if (!empty($matches)) { return intval($matches[0]); } else { return 0; } } else { return 0; } } public function insertData($data) { $this->insert($data); return ($this->db->affectedRows() > 0); } }