order by in all laravel code example
Example 1: laravel get all records order by
$posts = Post::orderBy('created_at', 'desc')->get();
Example 2: get all sort by laravel
$results = Project::orderBy('name')->get();
$posts = Post::orderBy('created_at', 'desc')->get();
$results = Project::orderBy('name')->get();