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