@ynoth25 you did not finish your query. You can get stdClass object(s) using first (single instance) or get (collection of instances) methods; or if there is an alias for the function result, use value:
$foo = DB::table('ws_dtr')->selectRaw("dtr_subtotal($student_id, $start_date, $end_date) as foo") ->first();
Or, (I don't know if an alias like this is valid PostGRES syntax, but this is the general idea)
DB::table('ws_dtr')->selectRaw("dtr_subtotal($student_id, $start_date, $end_date) as foo") ->value('foo');