本文整理汇总了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);
}
示例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'));
}
示例3: getIdsByNames
public static function getIdsByNames($names)
{
if (!empty($names)) {
return Album::whereIn('name', $names)->lists('id');
} else {
return 0;
}
}
示例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();
}
示例5: whereIn
public function whereIn()
{
$values = array('Something Corporate', 'The Ataris');
//return Album::whereNotIn('artist',$values)
return Album::whereIn('artist', $values)->toSql();
}