In L-4 it was simple:
$random_quote = Quotation::all()->random(1);
But now in L-5 not a single method described in this post is working: Lar
The orderByRaw('RAND()') has 2 issues:
Here is the solution i used, which seems to be a bit better:
$cnt = $records->count();
if ($cnt == 0)
return;
$randIndex = rand(0, $cnt-1);
$obj = $records->skip($randIndex)->take(1)->first();
EDIT: Please note that my solution may be a problem (crash if no luck) in case of parrallel requests to the database, if some records are deleted between the "count()" and the "skip()".