📜  随机记录在 karavel 8 中通过分页获取 - 无论代码示例

📅  最后修改于: 2022-03-11 14:59:01.199000             🧑  作者: Mango

代码示例1
Product::orderBy(DB::raw('RAND()'))->take(10)->get();
$products = Product::all()->random();
$products = Product::all()->random(10);
$products = Product::all()->orderBy(DB::raw('RAND(1234)'))->paginate(4);