public function getDataAjax(Request $request) { $dataRequest = $request->all(); $pageCurrent = $dataRequest['current']; $limit = $dataRequest['rowCount']; $offset = ($pageCurrent - 1) * $limit; $config = array('limit' => $limit, 'offset' => $offset); $model = new Pages(); $result = $model->getDataForPaginationAjax($dataRequest, $config); # Render field action foreach ($result['rows'] as $k => $item) { $result['rows'][$k]['action'] = create_field_action('admin/pages', $item->id); } $data['current'] = $pageCurrent; $data['rowCount'] = $limit; $data['total'] = $result['total']; $data['rows'] = $result['rows']; $data['_token'] = csrf_token(); die(json_encode($data)); }
public function getDataAjax(Request $request) { $dataRequest = $request->all(); $type = $request->type; $pageCurrent = $dataRequest['current']; $limit = $dataRequest['rowCount']; $offset = ($pageCurrent - 1) * $limit; $config = array('limit' => $limit, 'offset' => $offset); $model = new Product(); if ($type == "all") { $result = $model->getDataForProductList($dataRequest, $config, "all"); } else { if ($type == "stock") { $result = $model->getDataForProductList($dataRequest, $config, "stock"); } else { if ($type == "closed") { $result = $model->getDataForProductList($dataRequest, $config, "closed"); } } } # Render field action foreach ($result['rows'] as $k => $item) { $result['rows'][$k]['action'] = create_field_action('admin/product', $item->id); } $data['current'] = $pageCurrent; $data['rowCount'] = $limit; $data['total'] = $result['total']; $data['rows'] = $result['rows']; $data['_token'] = csrf_token(); die(json_encode($data)); }