Fix create and edit gadaian api: set null value if value passed is null
This commit is contained in:
@@ -91,9 +91,9 @@ class MarhunController extends Controller
|
|||||||
'n_marhun' => $nilai_marhun
|
'n_marhun' => $nilai_marhun
|
||||||
];
|
];
|
||||||
|
|
||||||
// Remove keys berat_batu_permata if value is null
|
// Set value berat_batu_permata to null if value passed is null
|
||||||
if($marhunToCreate['berat_batu_permata'] == '') {
|
if($marhunToCreate['berat_batu_permata'] == '') {
|
||||||
unset($marhunToCreate['berat_batu_permata']);
|
$marhunToCreate['berat_batu_permata'] = null;
|
||||||
};
|
};
|
||||||
|
|
||||||
$cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$kodcaw)->first();
|
$cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$kodcaw)->first();
|
||||||
@@ -175,9 +175,9 @@ class MarhunController extends Controller
|
|||||||
'n_marhun' => $nilai_marhun
|
'n_marhun' => $nilai_marhun
|
||||||
];
|
];
|
||||||
|
|
||||||
// Remove keys berat_batu_permata if value is null
|
// Set value berat_batu_permata to null if value passed is null
|
||||||
if($marhunToUpdate['berat_batu_permata'] == '') {
|
if($marhunToUpdate['berat_batu_permata'] == '') {
|
||||||
unset($marhunToUpdate['berat_batu_permata']);
|
$marhunToUpdate['berat_batu_permata'] = null;
|
||||||
};
|
};
|
||||||
|
|
||||||
$jemas = Marhun::on($cawangan['mysql'])->where([['recno','=',$request->recno],['norujukan','=',$norujukan]])->update($marhunToUpdate);
|
$jemas = Marhun::on($cawangan['mysql'])->where([['recno','=',$request->recno],['norujukan','=',$norujukan]])->update($marhunToUpdate);
|
||||||
|
|||||||
Reference in New Issue
Block a user