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


PHP Person::find方法代码示例

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


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

示例1: show

 public function show($personId)
 {
     $person = Person::find($personId);
     $tree = $person->buildRelationsTree();
     JavaScript::put(['gentree' => $tree, 'currentElementId' => $personId]);
     return view('person.gentree.show');
 }
开发者ID:sabahtalateh,项目名称:familyeditor,代码行数:7,代码来源:PersonGenTreeController.php

示例2: actionIncoming

 public function actionIncoming($id)
 {
     $user_id = NULL;
     $from = Yii::$app->request->post('From');
     $body = Yii::$app->request->post('Body');
     // Lookup user based on a few different methods
     // First, check with basic number with +1 removed
     $number = str_replace('+1', '', $from);
     $person = Person::find()->where(['phone' => $number])->one();
     // If no results, add hyphens
     if (!$person) {
         $formatted_number = preg_replace("/^(\\d{3})(\\d{3})(\\d{4})\$/", "\$1-\$2-\$3", $number);
         $person = Person::find()->where(['phone' => $formatted_number])->one();
     }
     if ($person) {
         $user_id = $person->id;
     }
     if ($from) {
         $message = new Message();
         $message->message = $body;
         $message->project_id = $id;
         $message->time = time();
         $message->user_id = $user_id;
         $message->status = 2;
         $message->type = 'text';
         $message->number = $from;
         $message->save();
     }
 }
开发者ID:jcshep,项目名称:FrontRunner,代码行数:29,代码来源:MessageController.php

示例3: listFiles

 public function listFiles($target, $target_action, $target_id)
 {
     $resource_type = 'App\\Models\\' . ucfirst(str_singular($target));
     $uploader_id = Auth::user()->active_contact->id;
     if ($target == "posts") {
         if ($target_action == "create") {
             $post = Post::where('author_id', $uploader_id)->where("status_id", "=", POST_DRAFT_STATUS_ID)->where("ticket_id", $target_id)->first();
         } elseif ($target_action == "edit") {
             $post = Post::where("id", $target_id)->first();
         }
         $id = isset($post->id) ? $post->id : null;
     } elseif ($target == "tickets") {
         if ($target_action == "create") {
             $ticket = Ticket::where('status_id', TICKET_DRAFT_STATUS_ID)->where('creator_id', $uploader_id)->first();
         } else {
             $ticket = Ticket::where("id", $target_id)->first();
         }
         $id = isset($ticket->id) ? $ticket->id : null;
     } elseif ($target == "people") {
         $target_id = is_null($target_id) ? Auth::user()->owner->id : $target_id;
         $person = Person::find($target_id);
         $id = $person->id;
     }
     $files = is_null($id) ? [] : File::where('resource_type', $resource_type)->where("resource_id", $id)->get();
     foreach ($files as $file) {
         $file->size = filesize(RESOURCES . DS . $file->file_path . DS . $file->file_name);
     }
     return $files;
 }
开发者ID:pinkynrg,项目名称:convergence2.0,代码行数:29,代码来源:FilesController.php

示例4: checkIfChildAndParentsAreInTheSameFamily

 public function checkIfChildAndParentsAreInTheSameFamily(Person $father, Person $mother, Person $child)
 {
     $fathersFamily = Person::find($father->id)->family_id;
     $mothersFamily = Person::find($mother->id)->family_id;
     $childFamily = Person::find($child->id)->family_id;
     $families = array_unique([$fathersFamily, $mothersFamily, $childFamily]);
     $this->assertEquals(1, count($families));
 }
开发者ID:sabahtalateh,项目名称:familyeditor,代码行数:8,代码来源:FunctionalTester.php

示例5: actionPerson

 public function actionPerson($query)
 {
     Yii::$app->response->format = Response::FORMAT_JSON;
     $fullName = new Expression('CONCAT(`person_last_name`, " ", `person_first_name`, " ", `person_second_name`)');
     $model = Person::find()->select(['full_name' => $fullName, 'person_id'])->where(['like', $fullName, $query])->orderBy('full_name')->asArray()->all();
     return array_map(function ($value) {
         return ['id' => $value['person_id'], 'value' => $value['full_name']];
     }, $model);
 }
开发者ID:serge-larin,项目名称:debt-test,代码行数:9,代码来源:AutocompleteController.php

示例6: searchPerson

 public function searchPerson($full_name)
 {
     $query = Person::find();
     $query->where('user.id <> ' . Yii::$app->user->getId());
     $query->joinWith('user');
     $query->limit(10);
     $query->andFilterWhere(['like', 'CONCAT(person.first_name, person.last_name)', $full_name]);
     $query->select(['user.id', 'CONCAT(person.first_name, " ", person.last_name) as full_name']);
     return $query->asArray()->all();
 }
开发者ID:nicovicz,项目名称:portalctv,代码行数:10,代码来源:PersonSearch.php

示例7: update

 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(Request $request, $id)
 {
     $name = Input::get('data');
     if ($name == 'lesson') {
         $data = Person::find($id)->lesson;
     } elseif ($name == 'seminar') {
         $data = Lessons::find($id)->seminar;
     }
     return response()->json($data);
 }
开发者ID:cookies5127,项目名称:cookiesblog,代码行数:17,代码来源:IndexController.php

示例8: actionIndex

 public function actionIndex()
 {
     $sort = isset($_GET['sort']) ? \Yii::$app->request->get('sort') : 'firstname';
     $order = isset($_GET['order']) ? strtoupper(\Yii::$app->request->get('order')) : 'ASC';
     $q = isset($_GET['q']) ? \Yii::$app->request->get('q') : '';
     if ($q != '') {
         $persons = Person::find()->where("firstname LIKE '%{$q}%' OR lastname LIKE '%{$q}%'")->orderBy("{$sort} {$order}")->all();
     } else {
         $persons = Person::find()->orderBy("{$sort} {$order}")->all();
     }
     return $this->render('index', ['persons' => $persons, 'sort' => $sort, 'order' => $order, 'q' => $q]);
 }
开发者ID:jrss95,项目名称:persons,代码行数:12,代码来源:SiteController.php

示例9: search

 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Person::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]);
     $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'name_eng', $this->name_eng]);
     return $dataProvider;
 }
开发者ID:martirosyan-kar,项目名称:transproject-trash,代码行数:21,代码来源:PersonSearch.php

示例10: search

 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Person::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, 'sex' => $this->sex, 'address_id' => $this->address_id, 'rec_status_id' => $this->rec_status_id, 'user_id' => $this->user_id, 'dc' => $this->dc]);
     $query->andFilterWhere(['like', 'lname', $this->lname])->andFilterWhere(['like', 'fname', $this->fname])->andFilterWhere(['like', 'mname', $this->mname])->andFilterWhere(['like', 'birthday', $this->birthday])->andFilterWhere(['like', 'email', $this->email])->andFilterWhere(['like', 'phone', $this->phone])->andFilterWhere(['like', 'note', $this->note]);
     return $dataProvider;
 }
开发者ID:slavam,项目名称:placement,代码行数:21,代码来源:PersonSearch.php

示例11: search

 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Person::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, 'register_date' => $this->register_date, 'person_type_id' => $this->person_type_id, 'tud_id' => $this->tud_id]);
     $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'emailaddress', $this->emailaddress])->andFilterWhere(['like', 'picture', $this->picture]);
     return $dataProvider;
 }
开发者ID:janwillemm,项目名称:sa-matcher,代码行数:21,代码来源:PersonSearch.php

示例12: search

 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Person::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(['person_id' => $this->person_id, 'is_student' => $this->is_student, 'is_coach' => $this->is_coach, 'person_rate' => $this->person_rate, 'recommend_by' => $this->recommend_by]);
     $query->andFilterWhere(['like', 'person_wechat_id', $this->person_wechat_id])->andFilterWhere(['like', 'person_name', $this->person_name])->andFilterWhere(['like', 'phone_number', $this->phone_number]);
     return $dataProvider;
 }
开发者ID:boylee1111,项目名称:Reservation,代码行数:21,代码来源:PersonSearch.php

示例13: search

 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Person::find()->asArray();
     $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, 'birth_date' => $this->birth_date, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at]);
     $query->andFilterWhere(['like', 'firstname', $this->firstname])->andFilterWhere(['like', 'lastname', $this->lastname])->andFilterWhere(['like', 'zip_code', $this->zip_code]);
     return $dataProvider;
 }
开发者ID:sergeybardier,项目名称:sbtest,代码行数:21,代码来源:PersonSearch.php

示例14: store

 public function store(Requests\StorePersonChildrenRequest $request)
 {
     $childId = $request->get('child');
     $fatherId = $request->get('father');
     $motherId = $request->get('mother');
     // Check if persons in the same family
     $fathersFamily = Person::find($childId)->family_id;
     $mothersFamily = Person::find($fatherId)->family_id;
     $childFamily = Person::find($motherId)->family_id;
     if ($fathersFamily == $childFamily and $mothersFamily == $childFamily) {
         return \Redirect::back()->withErrors(['Потомок уже находится в одной семье с родителями']);
     }
     Person::find($childId)->makeChild($fatherId, $motherId);
     return \Redirect::route('person.gentree.show', $childId);
 }
开发者ID:sabahtalateh,项目名称:familyeditor,代码行数:15,代码来源:PersonChildrenController.php

示例15: search

 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Person::find();
     $query->innerJoin('job');
     $dataProvider = new ActiveDataProvider(['query' => $query, 'sort' => new Sort(['attributes' => ['name', 'firstname', 'lastname', 'job_name' => ['asc' => ['job.name' => SORT_ASC], 'desc' => ['job.name' => SORT_DESC]], 'created_at', 'updated_at']])]);
     $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(['job_id' => $this->job_id, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at]);
     $query->andFilterWhere(['like', 'document', $this->document])->andFilterWhere(['like', 'firstname', $this->firstname])->andFilterWhere(['like', 'lastname', $this->lastname])->andFilterWhere(['like', 'job.name', $this->job_name]);
     return $dataProvider;
 }
开发者ID:edarkzero,项目名称:mi_taller,代码行数:22,代码来源:PersonSearch.php


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