What are the difference between latest() and oldest() in Laravel?

The latest()and oldest() functions allow us to easily order results by date. The result will be ordered by the created_at column. We can also pass the column name that we wish to sort by.





Suggest An Answer

Our Particitants

latest() retrieves the data from the database and orders them by timestamps so that the last inserted row will be shown as the first one and so on.

oldest() does the exact opposite and rows are retrieved in their inserted order.

Latest post from Laravel Interview Questions

Ask Question