Laravel:雄辩的跳过记录 [英] Laravel : Eloquent Skip records
本文介绍了Laravel:雄辩的跳过记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我如何吸引用户,但仅从某个位置开始?
我首先获得50:
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();
但是现在我想要50个,因此第50至100个记录。
But now I want the 50 after this, so the 50th to 100th records.
谢谢
推荐答案
您可以使用 skip()
Laravel eloqunt提供了实现此目标的好方法。
Laravel eloqunt provides nice way to achieve this.
$users = User::orderBy('xp', 'DESC')->skip(50)->take(50)->get();
希望这会有所帮助。
这篇关于Laravel:雄辩的跳过记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文