Support the ongoing development of Laravel.io →
posted 8 years ago
Eloquent

I have a slider on the home page with the last 3 rows added here is my code and it's working perfectly, this is in my web.php route file and I'm passing it using compact('post')

 $posts = Post::orderBy('created_at', 'desc')->take(3)->get();

After the slider I want to continue to display the rest of the post. So I need something like:

$olderPost = Post::orderBy('created_at', 'desc')-> Except the first 3 rows that I already used
Last updated 3 years ago.
0

try using skip and take as described in documentation

https://laravel.com/docs/5.3/queries

$posts = Post::orderBy('created_at', 'desc')->skip(3)->take(3)->get();
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.