update when storing gadai data for one percent

This commit is contained in:
Hafifie PKB
2023-11-09 01:31:59 +08:00
committed by Hafifie PKB
parent c999d26886
commit e44bdca389
4 changed files with 129 additions and 30 deletions
+8 -1
View File
@@ -2,7 +2,7 @@
namespace App\Services;
use App\KadarUpah;
class OnePercentServices
{
@@ -47,4 +47,11 @@ class OnePercentServices
return ['keuntungan' => $keuntungan,'onepercent' => $onepercent, 'ujrah' => $ujrah_sebenar];
}
public function getKadarUjrah(float $nilaimarhun = 0.0) : Float{
$kadarujrah = KadarUpah::on('mysql7')->select('kadarujrah')->where([['min','<=',$nilaimarhun],['max','>=',$nilaimarhun]])->get()->toArray();
return isset($kadarujrah[0]) ? $kadarujrah[0]['kadarujrah'] : 0;
}
}