Question : laravel random query
Answered by : troubled-tiger-h3224zn6s3rh
User::inRandomOrder()->limit(5)->get();
Source : | Last Update : Fri, 03 Sep 21
Question : laravel get random row
Answered by : alberto-peripolli
User::all()->random();
User::all()->random(10); // The amount of items you wish to receive
Source : https://stackoverflow.com/questions/13917558/laravel-eloquent-or-fluent-random-row | Last Update : Wed, 29 Apr 20
Question : in random order laravel
Answered by : lokesh-ramchandani-in6l3jq294i2
Model::select('column')->where('column','value')->inRandomOrder() ->limit(2) // here is yours limit ->get();
------------------ OR --------------------
Model::inRandomOrder()->select('column')->where('column','value')->first();
Source : | Last Update : Sat, 24 Oct 20
Question : laravel random record
Answered by : enchanting-emu-ofn4d0wz1day
// 5 indicates the number of records
User::inRandomOrder()->limit(5)->get();
// get one random record
User::inRandomOrder()->first();
Source : https://stackoverflow.com/questions/13917558/laravel-eloquent-or-fluent-random-row | Last Update : Wed, 13 Apr 22