当前位置: 首页>>代码示例>>PHP>>正文


PHP Contact::find方法代码示例

本文整理汇总了PHP中app\models\Contact::find方法的典型用法代码示例。如果您正苦于以下问题:PHP Contact::find方法的具体用法?PHP Contact::find怎么用?PHP Contact::find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在app\models\Contact的用法示例。


在下文中一共展示了Contact::find方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: search

 /**
  * 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;
 }
开发者ID:hlcborg,项目名称:primlacosadv,代码行数:21,代码来源:ContactSearch.php

示例2: search

 /**
  * 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;
 }
开发者ID:nguyendtu,项目名称:VietvietTravel,代码行数:21,代码来源:ContactSearch.php

示例3: search

 /**
  * 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;
 }
开发者ID:Nemmo,项目名称:alinakz,代码行数:21,代码来源:ContactSearch.php

示例4: search

 /**
  * 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;
 }
开发者ID:vespagointer,项目名称:yii2-moph,代码行数:22,代码来源:ContactSearch.php

示例5: search

 /**
  * 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;
 }
开发者ID:livingdreams,项目名称:kidcrossing,代码行数:23,代码来源:ContactSearch.php

示例6: search

 /**
  * 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;
 }
开发者ID:psicinski,项目名称:contactBook,代码行数:23,代码来源:ContactSearch.php

示例7: postContact

 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);
 }
开发者ID:josmel,项目名称:hostpots,代码行数:16,代码来源:ProfileController.php

示例8: search

 /**
  * 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;
 }
开发者ID:Konsul117,项目名称:phonebook,代码行数:24,代码来源:ContactSearch.php

示例9: actionIndex

 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]);
 }
开发者ID:Nechhist,项目名称:to.ru,代码行数:22,代码来源:ContactController.php

示例10: destroy

 /**
  * 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');
 }
开发者ID:danielchikaka,项目名称:osh,代码行数:12,代码来源:ContactController.php

示例11: actionQuery1

 public function actionQuery1()
 {
     $data = Contact::find()->where('id>2')->orderBy('firstname', 'lastname');
     $dataProvider = new ActiveDataProvider(['query' => $data]);
     return $this->render('query1', ['dataProvider' => $dataProvider]);
 }
开发者ID:vespagointer,项目名称:yii2-moph,代码行数:6,代码来源:QueryController.php

示例12: deleteContact

 /**
  * 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');
     }
 }
开发者ID:RozimovschiiDenis,项目名称:Taxi,代码行数:15,代码来源:AdminSettingsController.php

示例13: actionMap

 public function actionMap()
 {
     $contacts = Contact::find()->all();
     return $this->render('map', ['contacts' => $contacts]);
 }
开发者ID:vespagointer,项目名称:yii2-moph,代码行数:5,代码来源:MapController.php

示例14: workersDataProvider

 protected function workersDataProvider($dept_id)
 {
     $dp = new ActiveDataProvider(['query' => Contact::find()->where(['dept' => $dept_id]), 'sort' => false]);
     return $dp;
 }
开发者ID:kintastish,项目名称:docflow,代码行数:5,代码来源:DeptController.php

示例15: destroy

 /**
  * 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/');
 }
开发者ID:jordanlovato,项目名称:HAprogcha,代码行数:13,代码来源:ContactController.php


注:本文中的app\models\Contact::find方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。