<?php
defined('BASEPATH') or exit('No direct script access allowed');
class M_user extends CI_Model
{
    public function klinik()
    {
        return $this->db->query("SELECT * FROM userV2");
    }

    public function klinikAkhir()
    {
        return $this->db->query("SELECT * FROM userV2 ORDER BY id DESC");
    }

    public function getUserSession()
    {

        $loginAs = $this->session->userdata('userLoginAs');
        $username = $this->session->userdata('username');
        $doctorId = $this->session->userdata('doctorId');
        $user = $this->db->query("SELECT * FROM userV2 where username = '$username' ");
        if($loginAs == 'dokter' ){
            $user = $this->db->query("SELECT *, FirstName as nama FROM Doctor where DoctorID = '$doctorId' ");
        }
        return $user;
    }

}