public function export(Request $request) { $brand = new Brand(); $builder = $brand->newQuery()->with('factory'); $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 = $brand->getTable(); $this->_total = $total; $this->_pagesize = $pagesize > $total ? $total : $pagesize; return $this->view('admin.brand.export'); } $data = $this->_getExport($request, $builder); return $this->success('', FALSE, $data); }
public function export(Request $request) { $brand = new Brand(); $builder = $brand->newQuery()->join('agent_brand', 'agent_brand.bid', '=', 'brands.id')->where('aid', $this->agent->getKey())->groupBy('brands.id'); $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 = $brand->getTable(); $this->_total = $total; $this->_pagesize = $pagesize > $total ? $total : $pagesize; return $this->view('agent-backend.brand.export'); } $data = $this->_getExport($request, $builder, null, ['brands.*']); return $this->success('', FALSE, $data); }