<?php namespace App\Controllers;
  
use \CodeIgniter\Controller;
 
use \Hermawan\DataTables\DataTable;
  
class UsersController extends Controller
{
    public function index()
    {
        helper('url');
        return view('list');
    }
  
    public function ajaxDataTables()
    {
        $db = db_connect();
        $builder = $db->table('userlist')->select('name, email, id');
          
        return DataTable::of($builder)
               ->addNumbering() //it will return data output with numbering on first column
               ->toJson();
    }
}
  
?>