How to retrieve rows by order with raw query in Laravel

There is an orderByRaw method in Laravel that lets you write your custom raw query to retrieve records by order. See the following code example with the task “Get the nearest office for given latitude and longitude”. App\Models\Office.php: To get the nearest office for a given latitude and longitude (columns lat and lng):