I'm doing a query and want to update the data, but I want to do a math operation first. How to simplify it?
my code below:
$jumlah = 10;
$Rpodetail = Rpodetail::where('rpo_id',$request->postore)->where('produk_id',$produkid)->first();
$total = $Rpodetail->sisa - $jumlah;
Rpodetail::where('rpo_id',$request->postore)->where('produk_id',$produkid)->update([
'sisa' => $total,
]);