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


PHP Album::whereIn方法代码示例

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


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

示例1: getViewIndexDatas

 private function getViewIndexDatas()
 {
     $current_user_id = Session::get('user')['id'];
     $owners_id = Follow::where('follower_id', $current_user_id)->where('is_deleted', 0)->get(['followed_id'])->toArray();
     array_walk($owners_id, function (&$value, $key) {
         $value = $value['followed_id'];
     });
     $owners_id[] = $current_user_id;
     //        $privacy = Privacy::where('name',"Công khai")->get()->first();
     $entries = Entry::whereIn('user_id', $owners_id)->where('privacy', 1)->orWhere('user_id', $current_user_id)->orderBy('updated_at', 'DESC')->paginate($this->entries_per_page);
     $left_albums = Album::whereIn('user_id', $owners_id)->where('privacy', 1)->orWhere('user_id', $current_user_id)->orderBy('updated_at', 'DESC')->get();
     //        $datas = array();
     //
     //        foreach ($entries as $index => $entry) {
     //            if (FEUsersHelper::isCurrentUser($entry->user_id)) {
     //                if($this->getEntry($entry->entry_id, $entry->type, null)){
     //                    $datas[] = $this->getEntry($entry->entry_id, $entry->type, null);
     //                }
     //            } else{
     //                if($this->getEntry($entry->entry_id, $entry->type, $privacy->id)){
     //                    $datas[] = $this->getEntry($entry->entry_id, $entry->type, $privacy->id);
     //                }
     //
     //            }
     //        }
     ////        $datas = $this->pagination($datas, 3, $page);
     $suggests = FEUsersHelper::getSuggestes();
     return array('datas' => $entries, 'suggestes' => $suggests, 'left_albums' => $left_albums);
 }
开发者ID:huuson94,项目名称:WebProject,代码行数:29,代码来源:FEViewController.php

示例2: index

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     //
     $sortby = Input::get('sortby');
     $order = Input::get('order');
     $keyword = Input::get('keyword');
     $option = Input::get('search_opt');
     if ($sortby && $option && $keyword && $option == "fullname") {
         $users = User::where('fullname', 'LIKE', "%{$keyword}%")->get();
         $users_id = array();
         foreach ($users as $key => $user) {
             $users_id[] = $user->id;
         }
         $albums = Album::whereIn('user_id', $users_id)->orderBy($sortby, $order)->paginate(8);
     } elseif ($sortby && $option && $keyword && $option == "title") {
         $albums = Album::select('*')->where('title', 'LIKE', '%' . $keyword . '%')->orderBy($sortby, $order)->paginate(5);
     } elseif ($keyword && $option == "fullname") {
         $users = User::where('fullname', 'LIKE', "%{$keyword}%")->get();
         $users_id = array();
         foreach ($users as $key => $user) {
             $users_id[] = $user->id;
         }
         $albums = Album::whereIn('user_id', $users_id)->paginate(8);
     } elseif ($keyword && $option == "title") {
         $albums = Album::select('*')->where($option, 'LIKE', '%' . $keyword . '%')->paginate(5);
     } elseif ($sortby && $order) {
         $albums = Album::select('*')->orderBy($sortby, $order)->paginate(8);
     } else {
         $albums = Album::select('*')->paginate(5);
     }
     return View::make('backend.album.index', compact('albums', 'sortby', 'order', 'keyword', 'option'));
 }
开发者ID:huuson94,项目名称:btlwebapp,代码行数:37,代码来源:BEAlbumController.php

示例3: getIdsByNames

 public static function getIdsByNames($names)
 {
     if (!empty($names)) {
         return Album::whereIn('name', $names)->lists('id');
     } else {
         return 0;
     }
 }
开发者ID:rituzy,项目名称:iblog,代码行数:8,代码来源:Album.php

示例4: getNewAlbumsNotification

 public function getNewAlbumsNotification($current_user_id, $last_time)
 {
     $followed_users = Follow::where('follower_id', '=', $current_user_id)->select('followed_id')->get();
     $new_albums = Album::whereIn('user_id', $followed_users->fetch('followed_id')->toArray())->where('privacy', 1)->where('created_at', '>=', $last_time)->get();
     return $new_albums ? $new_albums : array();
 }
开发者ID:huuson94,项目名称:WebProject,代码行数:6,代码来源:BaseController.php

示例5: whereIn

 public function whereIn()
 {
     $values = array('Something Corporate', 'The Ataris');
     //return Album::whereNotIn('artist',$values)
     return Album::whereIn('artist', $values)->toSql();
 }
开发者ID:nattaphat,项目名称:cuse2,代码行数:6,代码来源:AlbumController.php


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