Retrieve a Random Record from Your Database

LaravelPosted on

Sometimes we need to retrieve a random record from our DB. By using Eloquent we can easily do what we want:

// Get the random model
$random = Model::inRandomOrder()->first();

Need a web developer? Maybe we can help, get in touch!

Similar Posts

More content in Laravel category