<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');

        class beranda_model extends CI_Model {

  
            public function __construct() {
                parent::__construct();
                $this->load->database();
            }

            function pegawai() {
            $menus='';
            $query=$this->db->query("select count( nama ) as jumlah
FROM pegawai
                 ");
                   if ($query->num_rows() > 0) {
                        foreach ($query->result() as $data) {
                              $menus[]=$data;
                        }
                        return $menus;
                  }
            } 
            function absen() {
            $menus='';
            $query=$this->db->query("select min( jam ) , absen. *,pegawai.nama
              FROM absen
              join pegawai on pegawai.id=absen.id
                                            
                                            WHERE tgl = CURDATE()

              
                 ");
                   if ($query->num_rows() > 0) {
                        foreach ($query->result() as $data) {
                              $menus[]=$data;
                        }
                        return $menus;
                  }
            } 
             
        }        
       