當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Person::where方法代碼示例

本文整理匯總了PHP中app\models\Person::where方法的典型用法代碼示例。如果您正苦於以下問題:PHP Person::where方法的具體用法?PHP Person::where怎麽用?PHP Person::where使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在app\models\Person的用法示例。


在下文中一共展示了Person::where方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getPerson

 public function getPerson($name = false, $where = [])
 {
     if (env('APP_DEBUG', false)) {
         $where_str = '';
         if (!empty($where)) {
             $where_str = 'where ';
             foreach ($where as $field => $val) {
                 $where_str .= ',' . $field . '=' . $val;
             }
         }
         \Debugbar::info('PersonRepository::getPerson(' . ' name:' . $name . ') ' . $where_str);
     }
     $people = false;
     if ($name) {
         $where['name'] = $name;
     }
     $people = empty($where) ? Person::all() : Person::where($where)->get();
     //
     // prepare results:
     // fixup sn urls from accounts and photos
     //
     if (!empty($people)) {
         foreach ($people as $key => $person) {
             if (isset($person->accounts)) {
                 $accts = explode(',', $person->accounts);
                 foreach ($accts as $act) {
                     $pair = explode('=', $act);
                     if (!empty($pair) && count($pair) == 2) {
                         $url = $this->getUrl($pair[0], $pair[1]);
                         if ($url) {
                             $people[$key][$pair[0]] = $url;
                         }
                     }
                 }
             }
             if (isset($person->photos)) {
                 $photos = explode(',', $person->photos);
                 foreach ($photos as $photo) {
                     $pair = explode('=', $photo);
                     if (!empty($pair) && count($pair) == 2) {
                         $people[$key][$pair[0] . '_photo'] = $pair[1];
                     }
                 }
             }
             \Debugbar::info('PersonRepository::getPerson - ' . print_r($people[$key], true));
         }
     }
     return $people;
 }
開發者ID:guybarnahum,項目名稱:reactor55,代碼行數:49,代碼來源:PersonRepository.php

示例2: getPerson

 public function getPerson($id = null)
 {
     try {
         $response = [];
         $statusCode = 200;
         //$city = City::all();
         $id = Request::segment(2);
         if ($id != null) {
             $id = Person::where('country_id', 'like', $this->getCountryIdOfFestival($id));
         }
         $id = $id->get();
         foreach ($id as $a) {
             $response[] = ['id' => $a->id, 'value' => $a->first_name . ' ' . $a->last_name . ', ' . $a->name . ' (' . $a->city . ')'];
         }
     } catch (Exception $e) {
         $statusCode = 404;
     } finally {
         return Response::json($response, $statusCode);
     }
 }
開發者ID:armannadim,項目名稱:banglafest,代碼行數:20,代碼來源:BackendController.php

示例3: run

 public function run()
 {
     // add a sample employee
     $person = Person::where('first_name', 'Francesco')->where('last_name', 'Meli')->first();
     if (isset($person)) {
         User::create(['person_id' => $person->id, 'username' => 'pinkynrg', 'password' => '$2y$10$95CM4BghK9tM0HxsDfAFyO0Ofw7AavS7rC6pArWpEk5ehw12P.U2a']);
     }
     // add a sample customer
     $person = Person::where('first_name', 'James')->where('last_name', 'Sample')->first();
     if (isset($person)) {
         User::create(['person_id' => $person->id, 'username' => 'sample_customer', 'password' => '$2y$10$95CM4BghK9tM0HxsDfAFyO0Ofw7AavS7rC6pArWpEk5ehw12P.U2a']);
     }
 }
開發者ID:pinkynrg,項目名稱:convergence2.0,代碼行數:13,代碼來源:DatabaseSeeder.php

示例4: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     Performer::find($id)->Festival()->detach();
     Performer::find($id)->Association()->detach();
     $person = Person::find($id);
     $a = Person::where('id', $id)->delete();
     $response = [];
     $response["name"] = $person->name;
     if ($a > trashed()) {
         $statusCode = 200;
         $response['result'] = "deleted";
     } else {
         $statusCode = 422;
         $response['result'] = "Cannot delete.";
     }
     return Response::json($response, $statusCode);
 }
開發者ID:armannadim,項目名稱:banglafest,代碼行數:23,代碼來源:PersonController.php

示例5: person

 public function person($company_id)
 {
     $person = Person::where('salesman_yn', 'Y')->where('company_id', $company_id)->orderBy('id', 'desc')->paginate(5);
     $data = ['person' => $person];
     return view('order.person', compact('data'));
 }
開發者ID:comsi02,項目名稱:ordermart,代碼行數:6,代碼來源:OrderController.php

示例6: index

 public function index()
 {
     $person = Person::where('id', '>=', '1')->orderBy('id', 'desc')->paginate(5);
     return view('person.index', compact('person'));
 }
開發者ID:comsi02,項目名稱:ordermart,代碼行數:5,代碼來源:PersonController.php


注:本文中的app\models\Person::where方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。