LMSouq
php-dev Open

Laravel - Eloquent or Fluent random row

DI
DigitalWM
1 month ago
3 views
Problem Description
How can I select a random row using Eloquent or Fluent in Laravel framework? I know that by using SQL, you can do order by RAND(). However, I would like to get the random row **without** doing a count on the number of records prior to the initial query. Any ideas?

AI-Generated Solution

Powered by LMSouq AI · GPT-4.1-mini

✓ Solution Ready
Analyzing problem and generating solution…
Was this solution helpful?
Back to Knowledge Base