【发布时间】:2017-08-02 17:03:16
【问题描述】:
我想跳过,集合中的一些元素
$post_one = Post_one::all();
$post_two = Post_two::all();
$posts = collect();
if($post_one){
foreach($post_one as $post){
$posts->push($post);
}
}
if($post_two){
foreach($post_two as $post){
$posts->push($post);
}
}
//now i want to skip n=3, element form the collection of posts
$posts = $posts->sortBy('created_at')-<skip(3)->take(3);//does not work
错误::方法跳过不存在。
【问题讨论】:
-
跳过 3 后也要拿 3 吗?
-
你找到其他方法了吗?
标签: php laravel collections