public function export(Request $request) { $agent = new Agent(); $builder = $agent->newQuery()->join('factory_agent', 'factory_agent.aid', '=', 'agents.id')->where('fid', '=', $this->factory->getKey()); $page = $request->input('page') ?: 0; $pagesize = $request->input('pagesize') ?: config('site.pagesize.export', 1000); $total = $this->_getCount($request, $builder); if (empty($page)) { $this->_of = $request->input('of'); $this->_table = $agent->getTable(); $this->_total = $total; $this->_pagesize = $pagesize > $total ? $total : $pagesize; return $this->view('factory-backend.agent.export'); } $data = $this->_getExport($request, $builder, null, 'agents.*'); return $this->success('', FALSE, $data); }