<?php

defined('BASEPATH') or exit('No direct script access allowed');

class Student extends CI_Controller
{
    public function __construct()
    {
        parent::__construct();
        $this->load->model('Student_model');
    }

    public function listing()
    {
        $request = $this->input->get();
        
        $data = $this->Student_model->listing($request);
   
        echo json_encode($this->Student_model->build_datatables($request['draw'], 
        $this->Student_model->totalCount(), 
        $this->Student_model->filteredCount($request),
         $data), JSON_UNESCAPED_UNICODE);
    }
    
    public function search_student()
	{
		$request = $this->input->get();
		$this->load->model('Student_model');
		echo json_encode([
			'success' => true,
			'data' => [
				'error' => 0,
				'result' => $this->Student_model->searchStudent($request),
			],
		], JSON_UNESCAPED_UNICODE);
	}
}
