1
我想从收集如何从集合中跳过第n个元素?
$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以及? –
你有没有找到其他方法来做到这一点? –