コード例 #1
0
 /**
  * Get list students for table data
  * @param Request $request
  * @return type
  */
 public function ajax(Request $request)
 {
     $order = $request->input('order');
     $search = $request->input('search');
     $limit = (int) $request->input('length');
     $offset = (int) $request->input('start');
     $draw = (int) $request->input('draw');
     $filter = $request->input('filter');
     // Get list student with order, search, pagination and filter
     $data = $this->student->getListStudents($limit, $offset, $order, $search, $filter);
     // Escape html for students
     $students = $this->student->escapeHtml($data['students']);
     $json = ['data' => $students, 'recordsTotal' => $data['totalRecords'], 'draw' => $draw, 'recordsFiltered' => $data['totalRecords']];
     return response()->json($json);
 }