private function permissiondataprovider($groups, $userId = 0) { if ($userId) { return new ActiveDataProvider(['query' => Permission::find()->where(['groupId' => $groups, 'status' => 1])->orWhere(['userId' => $userId]), 'pagination' => ['pageSize' => -1]]); } else { return new ActiveDataProvider(['query' => Permission::find()->where(['groupId' => $groups, 'status' => 1]), 'pagination' => ['pageSize' => -1]]); } }
public function search($params) { $query = Permission::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); if (!($this->load($params) && $this->validate())) { return $dataProvider; } $query->andFilterWhere(['Id' => $this->Id, 'userId' => $this->userId, 'groupId' => $this->groupId, 'createdOn' => $this->createdOn, 'createdBy' => $this->createdBy, 'updatedOn' => $this->updatedOn, 'updatedBy' => $this->updatedBy, 'status' => $this->status]); $query->andFilterWhere(['like', 'module', $this->module])->andFilterWhere(['like', 'controller', $this->controller])->andFilterWhere(['like', 'action', $this->action]); return $dataProvider; }