laravel model sortby code example
Example 1: eloquent model sort by ascending order
$posts = Post::orderBy('id', 'DESC')->get();
Example 2: laravel get all records order by
$posts = Post::orderBy('created_at', 'desc')->get();
Example 3: get all sort by laravel
$results = Project::orderBy('name')->get();