嗨我需要用前400行做一个雄辩的请求,并选择25随机。
现在查询看起来像这样。我得到最新的400行
$result = Model::where('status', '=', 0)
->orderBy('id', 'desc')
->limit(400)
->get();
我知道我可以做这样的事情,但是它会占用状态为0的所有行,但我想要排在前400名中的25个。
$result = Model::where('status', '=', 0)
-inRandomOrder()
->limit(25)
->get();