Laravel get records with Order BY

Last Updated: September 1, 2018

In your Laravel application if you want to get some records according to date you entered you can use the Order By clause as shown in below

SalesOrder::orderBy("order_date", "desc")->paginate(20)

Here you are using order_date field to select records by descending order. I am using pagination method to get only the first 20 records