Docs - sort by random instructions

Added instructions for sorting per database type. `RAND()` throws errors in PostgreSQL and SQLite
This commit is contained in:
Jason Irish 2016-09-20 14:16:22 -05:00 committed by GitHub
parent 32d1856d40
commit dcc51ec479
1 changed files with 3 additions and 2 deletions

View File

@ -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