Order by row and limit result in Laravel 5

You should use Fulls::orderBy(..)->take(5)->get() instead.


If you want to sort/order a collection you can use the sortBy() method.

eg.

$full = Fulls::get(); // Get the Fulls collections
$full = $full->sortBy('count')->take(5); 

You can skip for offset

$full = Fulls::orderBy('count', 'desc')->skip(0)->take(5)->get(); //get first 5 rows
$full = Fulls::orderBy('count', 'desc')->skip(5)->take(5)->get(); //get next 5 rows

Actual mysql query will look like:

SELECT * FROM fulls ORDER BY count DESC LIMIT 0,5