Exemplo n.º 1
0
 public function export(Request $request)
 {
     $store = new Store();
     $builder = $store->newQuery()->join('agent_store', 'agent_store.sid', '=', 'stores.id')->groupBy('stores.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 = $store->getTable();
         $this->_total = $total;
         $this->_pagesize = $pagesize > $total ? $total : $pagesize;
         return $this->view('admin.store.export');
     }
     $data = $this->_getExport($request, $builder, null, ['stores.*', DB::raw('COUNT(`agent_store`.`aid`) as `agents-count`')]);
     return $this->success('', FALSE, $data);
 }
Exemplo n.º 2
0
 public function export(Request $request)
 {
     $store = new Store();
     $builder = $store->newQuery()->join('agent_store', 'agent_store.aid', '=', 'stores.id')->where('aid', '=', $this->agent->getKey())->groupBy('stores.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 = $store->getTable();
         $this->_total = $total;
         $this->_pagesize = $pagesize > $total ? $total : $pagesize;
         return $this->view('agent-backend.store.export');
     }
     $data = $this->_getExport($request, $builder, null, 'stores.*');
     return $this->success('', FALSE, $data);
 }