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以及? –
你有沒有找到其他方法來做到這一點? –