public function data(Request $request)
 {
     $agent_audit = new StoreAudit();
     $builder = $agent_audit->newQuery()->with('agent');
     $_builder = clone $builder;
     $total = $_builder->count();
     unset($_builder);
     $data = $this->_getData($request, $builder);
     $data['recordsTotal'] = $total;
     $data['recordsFiltered'] = $data['total'];
     return $this->success('', FALSE, $data);
 }
 public function export(Request $request)
 {
     $store_audit = new StoreAudit();
     $page = $request->input('page') ?: 0;
     $pagesize = $request->input('pagesize') ?: config('site.pagesize.export', 1000);
     $total = $store_audit->count();
     if (empty($page)) {
         $this->_of = $request->input('of');
         $this->_table = $store_audit->getTable();
         $this->_total = $total;
         $this->_pagesize = $pagesize > $total ? $total : $pagesize;
         return $this->view('agent-backend.store.export');
     }
     $builder = $store_audit->newQuery()->where('aid', $this->agent->getKey());
     $data = $this->_getExport($request, $builder);
     return $this->success('', FALSE, $data);
 }