Answers for "laravel get random item"

PHP
5

laravel get random row

User::all()->random();
User::all()->random(10); // The amount of items you wish to receive
Posted by: Guest on April-22-2020
0

laravel random value from array

$k = array_rand($array);
$v = $array[$k];
Posted by: Guest on January-13-2021

Code answers related to "laravel get random item"

Browse Popular Code Answers by Language