Level 13
The latest() query builder method accept the name of the column as an optional parameter (by default it uses created_at ), is this what you want?
$categories = Category::latest('updated_at')->get();
This will return all the categories, from the most recently updated to the least.
Read more here : https://laravel.com/docs/5.4/queries#ordering-grouping-limit-and-offset
1 like