/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Contact::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, 'phone' => $this->phone]); $query->andFilterWhere(['like', 'company', $this->company])->andFilterWhere(['like', 'address', $this->address])->andFilterWhere(['like', 'city', $this->city])->andFilterWhere(['like', 'postal', $this->postal])->andFilterWhere(['like', 'email', $this->email])->andFilterWhere(['like', 'lat', $this->lat])->andFilterWhere(['like', 'lng', $this->lng]); return $dataProvider; }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Contact::find(); $dataProvider = new ActiveDataProvider(['query' => $query, 'sort' => ['defaultOrder' => ['regdate' => SORT_DESC]]]); $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, 'usebefore' => $this->usebefore, 'receiveinfo' => $this->receiveinfo, 'regdate' => $this->regdate, 'status' => $this->status]); $query->andFilterWhere(['like', 'fullname', $this->fullname])->andFilterWhere(['like', 'email', $this->email])->andFilterWhere(['like', 'phone', $this->phone])->andFilterWhere(['like', 'nation', $this->nation])->andFilterWhere(['like', 'message', $this->message])->andFilterWhere(['like', 'knwthrough', $this->knwthrough]); return $dataProvider; }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Contact::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, 'floor' => $this->floor, 'room' => $this->room, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at]); $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'second_name', $this->second_name])->andFilterWhere(['like', 'middle_name', $this->middle_name])->andFilterWhere(['like', 'phone', $this->phone]); return $dataProvider; }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Contact::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); $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; } $query->joinWith('tambon'); $query->andFilterWhere(['id' => $this->id]); $query->andFilterWhere(['like', 'firstname', $this->firstname])->andFilterWhere(['like', 'lastname', $this->lastname])->andFilterWhere(['like', 'address', $this->address])->andFilterWhere(['like', 'email', $this->email])->andFilterWhere(['like', 'base_tambon.tambon_name', $this->tambon_id]); return $dataProvider; }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Contact::find(); // 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, 'user_id' => $this->user_id, 'date' => $this->date]); $query->andFilterWhere(['like', 'email', $this->email])->andFilterWhere(['like', 'subject', $this->subject])->andFilterWhere(['like', 'body', $this->body]); return $dataProvider; }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Contact::find(); // 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, 'isFriend' => $this->isFriend]); $query->andFilterWhere(['like', 'firstname', $this->firstname])->andFilterWhere(['like', 'lastname', $this->lastname])->andFilterWhere(['like', 'phone', $this->phone])->andFilterWhere(['like', 'mail', $this->mail])->andFilterWhere(['like', 'address', $this->address])->andFilterWhere(['like', 'city', $this->city])->andFilterWhere(['like', 'zip', $this->zip]); return $dataProvider; }
public function postContact(FormContactRequest $request) { if (!empty($request)) { $data = $request->all(); $data['customer_id'] = Auth::customer()->user()->id; $data['flagactive'] = $request->get('flagactive', 1); if ($request->id) { $obj = Contact::find($request->id); $obj->update($data); } else { $obj = Contact::create($data); } return array('msg' => 'ok', 'state' => 1, 'data' => null); } return array('msg' => 'Error al guardar el modelo', 'state' => 0, 'data' => null); }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Contact::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); $query->select('contact.*,u.username'); $query->leftJoin('user u', 'u.id = author_id'); if (Yii::$app->authManager->getAssignment(AclHelper::ROLE_ADMIN, \Yii::$app->user->id) === null) { $query->where(['author_id' => Yii::$app->get('user', false)->id]); // $params['ContactSearch']['user_id'] = Yii::$app->get('user', false)->id; } if (!($this->load($params) && $this->validate())) { return $dataProvider; } $query->andFilterWhere(['id' => $this->id, 'create_stamp' => $this->create_stamp, 'update_stamp' => $this->update_stamp]); $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'surname', $this->surname])->andFilterWhere(['like', 'username', $this->username])->andFilterWhere(['like', 'phone', $this->phone]); return $dataProvider; }
public function actionIndex() { $model = new Contact(); $msgs = Contact::find()->orderBy('id DESC')->limit('50')->all(); if ($model->load(Yii::$app->request->post())) { $model->admin_id = Yii::$app->user->id; $model->time = time(); $model->save(); $this->redirect('contact'); } // проверка на время публикации (1 час) $openContactForm = true; $restTime = 0; foreach ($msgs as $one) { if ($one['admin_id'] == Yii::$app->user->id && $one['time'] >= time() - 60 * 60) { $openContactForm = false; $restTime = ceil(($one['time'] - (time() - 60 * 60)) / 60); break; } } return $this->render('index', ['model' => $model, 'msgs' => $msgs, 'openContactForm' => $openContactForm, 'restTime' => $restTime]); }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { $press = Contact::find($id); $press->delete(); return Redirect::route('contact.index'); }
public function actionQuery1() { $data = Contact::find()->where('id>2')->orderBy('firstname', 'lastname'); $dataProvider = new ActiveDataProvider(['query' => $data]); return $this->render('query1', ['dataProvider' => $dataProvider]); }
/** * Deletes the comment selected by the admin * @return type Redirect */ public function deleteContact() { if (Auth::check()) { $id = Input::get('id', true); $contact = Contact::find($id); $contact->delete(); die; } else { return Redirect::route('admin'); } }
public function actionMap() { $contacts = Contact::find()->all(); return $this->render('map', ['contacts' => $contacts]); }
protected function workersDataProvider($dept_id) { $dp = new ActiveDataProvider(['query' => Contact::find()->where(['dept' => $dept_id]), 'sort' => false]); return $dp; }
/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { // destroy a user $contact = \App\Models\Contact::find($id); $contact->delete(); redirect('contact/'); }
/** * @return get unread messages */ public function getMessages() { return Contact::find()->where(['status' => 0])->all(); }
/** * Returns contacts.blade.php page * @return type view */ public function contacts() { $data = ['title' => 'Contacts', 'number' => Contact::find(1)->tel, 'contacts' => Contact::all()]; return view('pages.mainUserPages.contacts')->with($data); }
public function delete($id) { $current_contact = Contact::find($id); $current_contact->delete(); return redirect()->route('home'); }
public function actionList() { $dataProvider = new ActiveDataProvider(['query' => Contact::find(), 'pagination' => ['pageSize' => 2]]); return $this->render('list', ['dataProvider' => $dataProvider]); }