I want to limit the number of results given by a Neoeloquent query, take() works fine but I don't know how should I use skip()? I read the laravel 5.2 Doc. I'm trying to use skip(10)->take(10) but it says "Method skip does not exist." here is my code:
$artifact=Models\Artifact::where('aid',$request->aid)->first();
$comments=$artifact->comments->take(10);
ok, I found an answer to my own question, since the result set of $artifact->comments is a laravel collection, there is no skip() method. using another method named slice() I could solve the problem and get my desired subset of result. Now I have:
which works fine. Another method named splice() returns similar values but please consider that it will modify the original result set.