当前位置: 首页>>代码示例>>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;未经允许,请勿转载。