/** * Creates data provider instance with search query applied * @param array $params * @return ActiveDataProvider */ public function buscarInactivos($params) { $query = Empresas::find(); $query->with(['usuario', 'franquicias', 'empresaFranquicias', 'empresaFranquicias.franquicia0']); $query->inactiva(); $dataProvider = new ActiveDataProvider(['query' => $query, 'sort' => ['defaultOrder' => ['fecha_creado' => SORT_DESC]], 'pagination' => ['pageSize' => 50]]); $this->load($params); if (!$this->validate()) { // uncomment the following line if you do not want to any records when validation fails // $query->where('0=1'); return $dataProvider; } // grid filtering conditions $query->andFilterWhere(['id' => $this->id, 'estado' => $this->estado, 'fecha_creado' => $this->fecha_creado, 'fecha_actualizado' => $this->fecha_actualizado]); $query->andFilterWhere(['like', 'nombre', $this->nombre])->andFilterWhere(['like', 'rnc', $this->rnc])->andFilterWhere(['like', 'logo', $this->logo])->andFilterWhere(['like', 'slogan', $this->slogan])->andFilterWhere(['like', 'web', $this->web])->andFilterWhere(['like', 'facebook', $this->facebook])->andFilterWhere(['like', 'twitter', $this->twitter])->andFilterWhere(['like', 'slug', $this->slug]); return $dataProvider; }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Empresas::find(); $query->with(['usuario', 'franquicias']); // $query->where(['user_id' => $user_id]); // add conditions that should always apply here $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; } // grid filtering conditions $query->andFilterWhere(['id' => $this->id, 'estado' => $this->estado, 'fecha_creado' => $this->fecha_creado, 'fecha_actualizado' => $this->fecha_actualizado]); $query->andFilterWhere(['like', 'nombre', $this->nombre])->andFilterWhere(['like', 'rnc', $this->rnc])->andFilterWhere(['like', 'logo', $this->logo])->andFilterWhere(['like', 'slogan', $this->slogan])->andFilterWhere(['like', 'web', $this->web])->andFilterWhere(['like', 'facebook', $this->facebook])->andFilterWhere(['like', 'twitter', $this->twitter])->andFilterWhere(['like', 'slug', $this->slug]); return $dataProvider; }