File: //var/www/html/qcr24/app/application/controllers/admin/Dashboard.php
<?php
defined('BASEPATH') or exit('No direct script access allowed');
class Dashboard extends MY_Controller
{
public function __construct()
{
parent::__construct();
$this->load->model('admin/mdashboard');
}
/**
* Index Page for this controller.
*
* Maps to the following URL
* http://example.com/index.php/welcome
* - or -
* http://example.com/index.php/welcome/index
* - or -
* Since this controller is set as the default controller in
* config/routes.php, it's displayed at http://example.com/
*
* So any other public methods not prefixed with an underscore will
* map to /index.php/welcome/<method_name>
* @see https://codeigniter.com/user_guide/general/urls.html
*/
public function index()
{
$data = array();
$data['total_car_van'] = $this->mdashboard->get_car_van();
$data['on_rentin_car_van'] = $this->mdashboard->get_on_rentin_car_van();
$data['service_dues'] = $this->mdashboard->get_service_due_list();
$data['pending_driver_validate'] = $this->mdashboard->get_pending_driver_validate();
$data['available_vehicle'] = $this->mdashboard->get_available_vehicle();
$data['return_notice'] = $this->mdashboard->get_return_notice();
$data['accidental_vehicle'] = $this->mdashboard->get_accidental_vehicle();
$data['accidental_pending_payment'] = $this->mdashboard->get_accidental_pending_payment();
$data['insurance_renewals'] = $this->mdashboard->get_insurance_renewals();
$data['total_failed_direct_debit'] = $this->mdashboard->get_failed_direct_debit();
$data['content'] = 'admin/dashboard';
$this->load->view('admin/layouts/index', $data);
}
public function update_last_service_km()
{
$car_id = $this->input->get('car_id');
$update_last_service_km = $this->mdashboard->update_last_service_km($car_id);
if($update_last_service_km){
$this->session->set_flashdata('success_msg', 'Service Record Updated Successfully');
}else {
$this->session->set_flashdata('error_msg', 'Service Record Not Updated');
}
redirect("admin/dashboard");
}
}