/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Rrhh::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); $this->load($params); if (!$this->validate()) { // uncomment the following line if you do not want to return any records when validation fails // $query->where('0=1'); return $dataProvider; } $query->andFilterWhere(['idRRHH' => $this->idRRHH, 'Edad' => $this->Edad, 'Salario' => $this->Salario, 'Jefe' => $this->Jefe]); $query->andFilterWhere(['like', 'Nombre', $this->Nombre])->andFilterWhere(['like', 'Apellido', $this->Apellido])->andFilterWhere(['like', 'descript', $this->descript])->andFilterWhere(['like', 'activate', $this->tablemode]); return $dataProvider; }
protected function findActiv($id) { if (($model = Rrhh::find()->where("idRRHH=:idRRHH", [":idRRHH" => $id])->andWhere("activate=:activate", [":activate" => 1])->one()) !== null) { return $model; } else { throw new NotFoundHttpException('Persona desactivada del sistema.'); } }
public function getAllRrhhZeroActivate() { return Rrhh::find()->where("activate=:activate", [":activate" => 0])->all(); }