How to subtract two columns from each other when using case expression – Laravel
I want to export some results in Excel from the Model method, so I added this, public static function getAllData() { $records = DB::table('orders as t1') ->leftjoin('payments as t2', 't1.ord_id', '=', 't2.pay_ord_id') ->select(DB::raw("case when pay_type_id=190 then t1.ord_total - t2.pay_amount as…