EVOLUTION-NINJA
Edit File: Dashboard.php
<?php namespace App\Controllers; class Dashboard extends BaseController { protected $db; public function __construct() { $this->db = \Config\Database::connect(); } public function index() { $id = session()->get('id'); if (!$id) { return redirect()->to('/'); } // ✅ TOTAL PRODUCTS $productBuilder = $this->db->table('products'); $productBuilder->where('status', 'active'); $data['project'] = $productBuilder->countAllResults(); // ✅ TOTAL FARMERS $farmerBuilder = $this->db->table('create_customer'); $farmerBuilder->where('status', 1); $data['progress'] = $farmerBuilder->countAllResults(); // ✅ TOTAL DEALERS 🔥 (NEW) $dealerBuilder = $this->db->table('dealers'); // <-- your table name $data['to_be_started'] = $dealerBuilder->countAllResults(); // ✅ FUND GRAPH (already correct) $builder = $this->db->table('released_amounts'); $builder->select('YEAR(released_date) as year, SUM(released_amount) as total_amount'); $builder->groupBy('year'); $query = $builder->get(); $data['fund_released'] = $query->getResultArray(); return view('dashboard/dashboard', $data); } }