convert sql query to laravel I have an sql qyery.

SELECT rt.id, rt.type, rt.total_no_of_rooms
     , SUM(r.no_of_rooms) as "reserved rooms" 
     , rt.total_no_of_rooms - SUM(r.no_of_rooms) as "rooms available"  
FROM Roomtypes rt 
LEFT OUTER JOIN Reservations r 
    ON r.roomtype_id = rt.id 
    AND '2018-04-11' &gt;= r.check_in 
    AND '2018-04-12' &lt;= r.check_out
GROUP BY rt.id, rt.type, rt.total_no_of_rooms


can anyone tell e how to convert it to laravel
This query is generated from midnightcowboycoder.com. Don't forget to replace backtick with a single quote.

DB::select(`rt.id`,`rt.type`,`rt.total_no_of_rooms`)
        -&gt;addSelect(DB::raw(`SUM(r.no_of_rooms) as reserved rooms`))
        -&gt;selectSub(`rt.total_no_of_rooms`, `rooms available`)
        -&gt;selectSub(`-`, `rooms available`)
        -&gt;selectSub(`SUM`, `rooms available`)
        -&gt;from(`Roomtypes as rt`)
        -&gt;join(`Reservations as r`, function($join) {
            $join-&gt;on(`r.roomtype_id`, `=`, `rt.id`)
                -&gt;on(`2018-04-11`, `&gt;=`, `r.check_in`)
                -&gt;on(`2018-04-12`, `&lt;=`, `r.check_out`);
            })
        -&gt;groupBy(`rt.id`)
        -&gt;groupBy(`rt.type`)
        -&gt;groupBy(`rt.total_no_of_rooms`)
        -&gt;get();