Dessauges Antoine
Dessauges Antoine

Reputation: 593

Laravel : Eloquent Skip records

How did i get my users but start only at a certain position ? I get the 50 first with :

$users = User::orderBy('xp', 'DESC')->take(50)->get();

But now I want the 50 after this, so the 50th to 100th records.

Thanks

Upvotes: 2

Views: 5521

Answers (1)

FULL STACK DEV
FULL STACK DEV

Reputation: 15971

You can use skip()

Laravel eloqunt provides nice way to achieve this.

$users = User::orderBy('xp', 'DESC')->skip(50)->take(50)->get();

Hope this helps.

Upvotes: 11

Related Questions