mercredi 2 août 2017

how to skip first n element from collection?

I want to skip, some element from collection

$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 

error::Call to undefined function App\Http\Controllers\reponse()



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire