mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Merge pull request #6044 from jsirish/patch-1
Docs - sort by random instructions
This commit is contained in:
commit
796ca2171d
@ -268,10 +268,11 @@ However you might have several entries with the same `FirstName` and would like
|
||||
'LastName'=>'ASC'
|
||||
));
|
||||
|
||||
You can also sort randomly.
|
||||
You can also sort randomly. Using the `DB` class, you can get the random sort method per database type.
|
||||
|
||||
:::php
|
||||
$players = Player::get()->sort('RAND()')
|
||||
$random = DB::get_conn()->random();
|
||||
$players = Player::get()->sort($random)
|
||||
|
||||
|
||||
## Filtering Results
|
||||
|
Loading…
Reference in New Issue
Block a user