laravel get random number of data from database

179

laravel get random number of data from database -

Model::select('column')
    ->where('column','value')
    ->inRandomOrder()
    ->limit(2) // here is yours limit
    ->get();

Comments

Submit
0 Comments