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


PHP Relationship::where方法代码示例

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


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

示例1: home_timeline

 /**
  * Returns a collection of the most recent Post  by the authenticating user and the users they follow
  * @return Response
  */
 public function home_timeline($id)
 {
     //get all follower where user id = follower_id
     $followers = Relationship::where('follower_id', $id)->get(array('following_id'));
     if ($followers->count() > 0) {
         $follower_id = array();
         array_push($follower_id, $id);
         foreach ($followers as $follower) {
             array_push($follower_id, $follower->following_id);
         }
         return Post::getPost($follower_id, $this->page, $this->per_page, $this->type);
     } else {
         return Response::json(array('status' => '0', 'message' => 'No user found'));
     }
 }
开发者ID:korrio,项目名称:wouchat-api,代码行数:19,代码来源:PostsController.php

示例2: friends_deprecated2

 /**
  * Display friends from given user id.
  *
  * @param  int  $id
  * @return Response
  */
 public function friends_deprecated2($id)
 {
     $followings = Relationship::where('follower_id', $id)->where('following_id', '!=', $id)->where('active', '=', '1')->get(array('following_id'));
     $folllowings_id = array();
     foreach ($followings as $following) {
         array_push($folllowings_id, $following->following_id);
     }
     $accounts = Relationship::whereIn('following_id', $folllowings_id)->where('follower_id', '=', $id)->where('active', '=', '1')->take($this->per_page)->skip($this->ofset)->get();
     $total_account = Relationship::whereIn('following_id', $folllowings_id)->where('follower_id', '=', $id)->count();
     foreach ($accounts as $account) {
         $account->following_account->birthday;
         $account->following_account->gender;
         $account->following_account->avatar;
         $account->following_account->cover;
         $account->following_account->is_following = Helpers::SK_isFollowing($account->following_account->id, $id);
         array_push($this->users, $account->following_account);
     }
     $response = array('status' => '1', 'page' => $this->page, 'per_page' => $this->per_page, 'pages' => ceil(count($this->users) / $this->per_page), 'total' => count($this->users), 'users' => $this->users);
     return Response::json($response);
 }
开发者ID:korrio,项目名称:wouchat-api,代码行数:26,代码来源:AccountController.php

示例3: scopeBlockRelationship

 public function scopeBlockRelationship($quest, $sender, $target)
 {
     //check if relationship already exists
     $results = DB::table('relationship')->select('*')->where('relationship_sender', '=', $target)->where('relationship_target', '=', $sender)->first();
     // if it's pending from someone requesting, then change to active
     if ($results) {
         Relationship::where('relationship_id', '=', $results->relationship_id)->update(array('relationship_status' => 'block'));
     }
     $relationship = new Relationship();
     $relationship->relationship_target = $target;
     $relationship->relationship_sender = $sender;
     $relationship->relationship_status = 'block';
     $relationship->save();
 }
开发者ID:jacobross85,项目名称:community,代码行数:14,代码来源:Relationship.php

示例4: getRelationshipList

 /**
  *   Función responsable de obtener el listado de parentescos civiles 
  *   disponibles para el país actual.
  *
  *   @return array, lista de parentescos civiles encontrados.
  */
 public function getRelationshipList($countryId = '')
 {
     if (empty($countryId)) {
         $countryId = Config::get('constants.APP.COUNTRY_CODES.CO');
     }
     $relationshipList = Relationship::where('countryId', $countryId)->orderBy(Config::get('constants.RELATIONSHIP.ATTRS.RELATIONSHIP_ID'))->get();
     return $relationshipList;
 }
开发者ID:jhoansebastianlara,项目名称:esclinicadigital,代码行数:14,代码来源:BaseController.php


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