$results = Project::orderBy('name')->get();
Ascending Order
$results = Project::all()->sortBy("name");
Descending Order
$results = Project::all()->sortByDesc("name");
Check out the documentation about Collections for more details.
https://laravel.com/docs/5.1/collections
$results = Project::orderBy('created_at', 'desc')->get();
Post a Comment