/** * Updates an existing Company model. * If update is successful, the browser will be redirected to the 'view' page. * @param integer $id * @return mixed */ public function actionUpdate($id) { //To check if the current company is assigned to this normal admin $this->checkValidCompany($id); $model = $this->findModel($id); $employeeSearch = new EmployeeSearch(['company_id' => $id]); $employeeData = $employeeSearch->search(Yii::$app->request->getQueryParams()); $employeeData->pagination->pageSize = 20; if ($model->load(Yii::$app->request->post()) && $model->save()) { return $this->redirect(['view', 'id' => $model->company_id]); } else { return $this->render('update', ['model' => $model, 'employeeSearch' => $employeeSearch, 'employeeData' => $employeeData]); } }
/** * Lists all Employee models. * @return mixed */ public function actionIndex() { $searchModel = new EmployeeSearch(); $dataProvider = $searchModel->search(Yii::$app->request->queryParams); return $this->render('index', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider]); }