public function index() { $storeIds = []; $storeIds[] = 0; $stores = StoreModel::where('company_id', Session::get('company_id'))->get(); foreach ($stores as $store) { $storeIds[] = $store->id; } $param['agents'] = AgentModel::whereIn('store_id', $storeIds)->paginate(10); $param['pageNo'] = 3; if ($alert = Session::get('alert')) { $param['alert'] = $alert; } return View::make('company.agent.index')->with($param); }