Created
December 12, 2013 11:22
-
-
Save borantula/7926528 to your computer and use it in GitHub Desktop.
Laravel 4 Eloquent Random Order. I always tend to forget it :)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//get 10 random products | |
$someProducts = Product::orderBy(DB::raw('RAND()'))->limit(10)->get(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment