/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = People::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(['id' => $this->id, 'dept_id' => $this->dept_id, 'job_id' => $this->job_id, 'edu_lvl_id' => $this->edu_lvl_id, 'edu_spec_id' => $this->edu_spec_id, 'listener_id' => $this->listener_id]); $query->andFilterWhere(['like', 'surname', $this->surname])->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'patronymic', $this->patronymic])->andFilterWhere(['like', 'login', $this->login])->andFilterWhere(['like', 'password', $this->password])->andFilterWhere(['like', 'email', $this->email])->andFilterWhere(['like', 'sot', $this->sot])->andFilterWhere(['like', 'published', $this->published])->andFilterWhere(['like', 'postaddress', $this->postaddress])->andFilterWhere(['like', 'cellphone', $this->cellphone])->andFilterWhere(['like', 'homephone', $this->homephone]); return $dataProvider; }
private function processDelete() { $ids = $this->getRandomsNumbers(50, 50000, 1); $queryesExecution = array(); $peoples = array(); foreach ($ids as $id) { Debug::timer(); // SELECT + DELETE DATA $people = Models\People::find($id); $peoples[] = $people; $people->delete(); $queryesExecution[] = number_format(Debug::timer() * 1000, 2); } return array($queryesExecution, $peoples); }
/** * Lists all People models. * @return mixed */ public function actionIndex() { $dataProvider = new ActiveDataProvider(['query' => People::find()]); return $this->render('index', ['dataProvider' => $dataProvider]); }
public function circle($id) { $circle = Circle::find($id); $temp = 0; foreach ($circle->enrollments as $enrollment) { if ($enrollment->people_id == Auth::user()->id) { $temp = 1; break; } } if ($temp == 0) { return 'You are not enrolled to this course!'; } $circleList = Circle::all(); $people = People::find(Auth::user()->id); return view('Pages.circlepage', compact('circle', 'circleList', 'people')); }