From e5b238bc80ec6e7b974005ec8f3f2662699478bd Mon Sep 17 00:00:00 2001 From: Hafifie PKB Date: Thu, 16 Nov 2023 09:55:31 +0800 Subject: [PATCH 1/5] fix rebet and ujrah untuk tebus and uncomment all audit --- app/Http/Controllers/GadaiController.php | 45 +++--- app/Http/Controllers/TebusController.php | 173 +++++++++++++++++++---- routes/web.php | 4 +- 3 files changed, 170 insertions(+), 52 deletions(-) diff --git a/app/Http/Controllers/GadaiController.php b/app/Http/Controllers/GadaiController.php index b017e23..f16f5e8 100644 --- a/app/Http/Controllers/GadaiController.php +++ b/app/Http/Controllers/GadaiController.php @@ -292,22 +292,23 @@ class GadaiController extends Controller 'ujrah' => $ujrah, 'onepercent' => $onepercent, 'margin_semasa' => $margin_pinjam, + 'tagbaru' => 1 )); $new_data = Gadai::on($cawangan['mysql'])->where('norujukan','=',$norujukan)->first(); - // $audit = new Audit(); - // $audit->users = $request->teller; - // $audit->actions = $request->transaction; - // $audit->norujukan = $norujukan; - // $audit->new_data = $new_data; - // if($request->transaction == 'Ubah Gadai'){ - // $audit->old_data = $old_data; - // } - // $audit->kodcaw = $request->kodcaw; - // $audit->created_at = $current; - // $audit->updated_at = $current; - // $audit->save(); + $audit = new Audit(); + $audit->users = $request->teller; + $audit->actions = $request->transaction; + $audit->norujukan = $norujukan; + $audit->new_data = $new_data; + if($request->transaction == 'Ubah Gadai'){ + $audit->old_data = $old_data; + } + $audit->kodcaw = $request->kodcaw; + $audit->created_at = $current; + $audit->updated_at = $current; + $audit->save(); return response()->json($gadai, 200); } @@ -547,16 +548,16 @@ class GadaiController extends Controller $new_data = Gadai::on($cawangan['mysql'])->where('norujukan','=',$norujukan)->first(); - // $audit = new Audit(); - // $audit->users = $request->teller; - // $audit->actions = 'Bayaran Ansuran'; - // $audit->norujukan = $norujukan; - // $audit->new_data = $new_data; - // $audit->old_data = $old_data; - // $audit->kodcaw = $kodcaw; - // $audit->created_at = $current; - // $audit->updated_at = $current; - // $audit->save(); + $audit = new Audit(); + $audit->users = $request->teller; + $audit->actions = 'Bayaran Ansuran'; + $audit->norujukan = $norujukan; + $audit->new_data = $new_data; + $audit->old_data = $old_data; + $audit->kodcaw = $kodcaw; + $audit->created_at = $current; + $audit->updated_at = $current; + $audit->save(); if(!$transaction || !$transaction_upah) { throw new \Exception('One of the database operations failed.'); diff --git a/app/Http/Controllers/TebusController.php b/app/Http/Controllers/TebusController.php index 24f7533..0ae3446 100644 --- a/app/Http/Controllers/TebusController.php +++ b/app/Http/Controllers/TebusController.php @@ -39,6 +39,8 @@ use App\AkruNet; use App\Services\OnePercentServices; use Illuminate\Http\Request; +use Illuminate\Support\Facades\Log; + use Carbon\Carbon; class TebusController extends Controller @@ -52,7 +54,9 @@ class TebusController extends Controller ->where('norujukan','=',$norujukan) ->first(); - $rebet = $this->rebetselepastawarruq($kodcaw,$norujukan); + $jeniskeuntungan = ($gadai_data['tagbaru'] == 1) ? 'onepercent' : 'asal'; + + $rebet = $this->rebetselepastawarruq($kodcaw,$norujukan,$jeniskeuntungan); $harga_tebus = $gadai_data['bakihargajualan'] - $rebet; @@ -65,7 +69,7 @@ class TebusController extends Controller return response()->json($hargatebus); } - public function hargaTebusTawarruq($kodcaw,$norujukan){ + public function hargaTebusTawarruq($kodcaw,$norujukan,$jeniskeuntungan){ $cawangan = Cawangan::on('mysql7') ->where('kodcaw','=',$kodcaw) ->first(); @@ -74,7 +78,7 @@ class TebusController extends Controller ->where('norujukan','=',$norujukan) ->first(); - $rebet = $this->rebetselepastawarruq($kodcaw,$norujukan); + $rebet = $this->rebetselepastawarruq($kodcaw,$norujukan,$jeniskeuntungan); $harga_tebus = $gadai_data['bakihargajualan'] - $rebet; @@ -87,7 +91,7 @@ class TebusController extends Controller return $hargatebus; } - public function kiraupahTawarruq($kodcaw,$norujukan){ + public function kiraupahTawarruq($kodcaw,$norujukan,$jeniskeuntungan){ $onepercentservices = new OnePercentServices(); $cawangan = Cawangan::on('mysql7') @@ -105,10 +109,13 @@ class TebusController extends Controller } $bilang_bln = $tempoh - $gadai_data['tempohbayar']; - $upah = $onepercentservices->kiraanKeuntunganSebenar($gadai_data['pinjaman'],$gadai_data['nilaimarhun'],$gadai_data['kadarupah'],$gadai_data['percentpinj']); - // $upahsemasa_raw = $bilang_bln * (($gadai_data['kadarupah']/100 )* $gadai_data['pinjaman']); - $upahsemasa_raw = $bilang_bln * $upah['keuntungan']; - + if($jeniskeuntungan == 'onepercent'){ + $upah = $onepercentservices->kiraanKeuntunganSebenar($gadai_data['pinjaman'],$gadai_data['nilaimarhun'],$gadai_data['kadarupah'],$gadai_data['percentpinj']); + $upahsemasa_raw = $bilang_bln * $upah['keuntungan']; + }else{ + $upahsemasa_raw = $bilang_bln * (($gadai_data['kadarupah']/100 )* $gadai_data['pinjaman']); + } + $upah_semasa_round = number_format($upahsemasa_raw,2); if(strpos($upah_semasa_round,',')){ $upah_semasa_round = str_replace(',','',$upah_semasa_round); @@ -121,7 +128,7 @@ class TebusController extends Controller return $upah_semasa; } - public function kiraUpahRebet($kodcaw,$norujukan){ + public function kiraUpahRebet($kodcaw,$norujukan,$jeniskeuntungan){ $onepercentservices = new OnePercentServices(); $cawangan = Cawangan::on('mysql7') @@ -140,9 +147,12 @@ class TebusController extends Controller $bilang_bln = $tempoh - $gadai_data['tempohbayar']; - $upah = $onepercentservices->kiraanKeuntunganSebenar($gadai_data['bakipjm'],$gadai_data['nilaimarhun'],$gadai_data['kadarupah'],$gadai_data['margin_semasa']); - $upahrebet_raw = $bilang_bln * $upah['keuntungan']; - // $upahrebet_raw = $bilang_bln * (($gadai_data['kadarupah']/100 )* $gadai_data['bakipjm']); + if($jeniskeuntungan == 'onepercent'){ + $upah = $onepercentservices->kiraanKeuntunganSebenar($gadai_data['bakipjm'],$gadai_data['nilaimarhun'],$gadai_data['kadarupah'],$gadai_data['margin_semasa']); + $upahrebet_raw = $bilang_bln * $upah['keuntungan']; + }else{ + $upahrebet_raw = $bilang_bln * (($gadai_data['kadarupah']/100 )* $gadai_data['bakipjm']); + } $upah_rebet_round = number_format($upahrebet_raw,2); if(strpos($upah_rebet_round,',')){ @@ -192,16 +202,16 @@ class TebusController extends Controller return $keuntungan_rebet_sebenar; } - public function upahTawarruq($kodcaw,$norujukan){ + public function upahTawarruq($kodcaw,$norujukan,$jeniskeuntungan){ - $upah_semasa = $this->kiraupahTawarruq($kodcaw,$norujukan); + $upah_semasa = $this->kiraupahTawarruq($kodcaw,$norujukan,$jeniskeuntungan); return response()->json(number_format($upah_semasa,2)); } - public function upahRebetTawarruq($kodcaw,$norujukan){ + public function upahRebetTawarruq($kodcaw,$norujukan,$jeniskeuntungan){ - $upah_rebet = $this->kiraUpahRebet($kodcaw,$norujukan); + $upah_rebet = $this->kiraUpahRebet($kodcaw,$norujukan,$jeniskeuntungan); return response()->json(number_format($upah_rebet,2)); } @@ -216,7 +226,7 @@ class TebusController extends Controller ->where('norujukan','=',$norujukan) ->first(); - $upahsemasa = $this->kiraupahTawarruq($kodcaw,$norujukan); + $upahsemasa = $this->kiraupahTawarruq($kodcaw,$norujukan,$request->jeniskeuntungan); $array_recno_marhun = $request->array_recno; @@ -418,7 +428,7 @@ class TebusController extends Controller return floatval(number_format($rebet,2)); } - function rebetselepastawarruq($kodcaw,$norujukan){ + function rebetselepastawarruq($kodcaw,$norujukan,$jeniskeuntungan){ $cawangan = Cawangan::on('mysql7') ->where('kodcaw','=',$kodcaw) ->first(); @@ -431,7 +441,7 @@ class TebusController extends Controller ->where('norujukan','=',$norujukan) ->sum('keuntungan_rebet'); - $upah_rebet = $this->kiraUpahRebet($kodcaw,$norujukan); + $upah_rebet = $this->kiraUpahRebet($kodcaw,$norujukan,$jeniskeuntungan); $rebet_raw =$gadai_data['upah12'] - $transaction_keuntungan - $upah_rebet; @@ -452,9 +462,8 @@ class TebusController extends Controller $cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$kodcaw)->first(); - if($request->jenisbayarantebus == "tawarruq") - { - $rebet = $this->rebetselepastawarruq($kodcaw,$norujukan); + if($request->jenisbayarantebus == "tawarruq"){ + $rebet = $this->rebetselepastawarruq($kodcaw,$norujukan,$request->jeniskeuntungan); } else if($request->jenisbayarantebus == "nottawarruq") { @@ -466,16 +475,25 @@ class TebusController extends Controller $gadai = Gadai::on($cawangan['mysql'])->where('norujukan','=',$norujukan)->first(); + $ujrah=0;$onepercent=0; if($gadai['hargajualan'] == null){ $harga_tebus = $this->hargaTebusNotTawarruq($kodcaw,$norujukan); $upah_tebus = $this->kiraUpahNotTawarruq($kodcaw,$norujukan); $upah_rebet = 0; $upah_rebet_sebenar = 0; }else{ - $harga_tebus = $this->hargaTebusTawarruq($kodcaw,$norujukan); - $upah_tebus = $this->kiraupahTawarruq($kodcaw,$norujukan); + $harga_tebus = $this->hargaTebusTawarruq($kodcaw,$norujukan,$request->jeniskeuntungan); + $upah_tebus = $this->kiraupahTawarruq($kodcaw,$norujukan,$request->jeniskeuntungan); $upah_rebet = $this->kiraUpahRebetSebenar($kodcaw,$norujukan); $upah_rebet_sebenar = $harga_tebus - $gadai['bakipjm']; + + if($request->jeniskeuntungan == 'onepercent'){ + $array_onepercent = $this->kiraupahUjrahOnePercent($kodcaw,$norujukan); + $array_onepercent_rebet = $this->kiraupahUjrahOnePercentRebate($kodcaw,$norujukan); + $margin_semasa = ($gadai['bakipjm']/$gadai['nilaimarhun']) * 100; + $ujrah = $array_onepercent['ujrah']; + $onepercent = $array_onepercent['onepercent']; + } } @@ -502,7 +520,9 @@ class TebusController extends Controller 'marhuntebus' => $request->marhun, 'historygadaian' => $norujukan, 'tarikhbyrn' => $current->toDateString(), - 'teller' => $request->teller + 'teller' => $request->teller, + 'ujrah' => $ujrah, + 'onepercent' => $onepercent, ]); $create_inoutmar = InOutMar::on($cawangan['mysql'])->create([ @@ -525,7 +545,14 @@ class TebusController extends Controller 'bayaran_pembiayaan' => $gadai['bakipjm'], 'keuntungan_rebet' => $upah_rebet_sebenar, 'tarikh_bayaran'=> $current, - 'kodcaw'=> $kodcaw + 'kodcaw'=> $kodcaw, + 'ujrah' => ($request->jeniskeuntungan == 'onepercent') ? $array_onepercent['ujrah'] : 0, + 'ujrah_rebet' => ($request->jeniskeuntungan == 'onepercent') ? $array_onepercent_rebet['ujrah'] : 0, + 'onepercent' => ($request->jeniskeuntungan == 'onepercent') ? $array_onepercent['onepercent'] : 0, + 'onepercent_rebet' => ($request->jeniskeuntungan == 'onepercent') ? $array_onepercent_rebet['onepercent'] : 0, + 'margin_semasa' => ($request->jeniskeuntungan == 'onepercent') ? $margin_semasa : 0, + 'tempoh' => $gadai['tempoh'], + 'beza_tempoh' => ($gadai['tempoh'] - $gadai['tempohbayar']), ]); if($request->jenistebus == 'P'){ @@ -587,7 +614,7 @@ class TebusController extends Controller if($request->jenisbayarantebus == "tawarruq") { - $rebet = $this->rebetselepastawarruq($kodcaw,$norujukan); + $rebet = $this->rebetselepastawarruq($kodcaw,$norujukan,$request->jeniskeuntungan); } else if($request->jenisbayarantebus == "nottawarruq") { @@ -604,7 +631,7 @@ class TebusController extends Controller 't_update' => $current->toDateString(), )); - $upah_rebet = $this->kiraUpahRebet($kodcaw,$norujukan); + $upah_rebet = $this->kiraUpahRebet($kodcaw,$norujukan,$request->jeniskeuntungan); $create_tebus = Tebus::on($cawangan['mysql'])->create([ 'kodcaw'=> $kodcaw, @@ -2196,4 +2223,94 @@ class TebusController extends Controller return response()->json($total_accrual_net); } + public function kiraupahUjrahOnePercent($kodcaw,$norujukan){ + $onepercentservices = new OnePercentServices(); + + $cawangan = Cawangan::on('mysql7') + ->where('kodcaw','=',$kodcaw) + ->first(); + + $gadai_data = Gadai::on($cawangan['mysql']) + ->where('norujukan','=',$norujukan) + ->first(); + + if($gadai_data['tempoh'] >= 12.0){ + $tempoh = 12; + }else{ + $tempoh = $gadai_data['tempoh']; + } + + $bilang_bln = $tempoh - $gadai_data['tempohbayar']; + $array_upah = $onepercentservices->kiraanKeuntunganSebenar($gadai_data['pinjaman'],$gadai_data['nilaimarhun'],$gadai_data['kadarupah'],$gadai_data['percentpinj']); + $ujrah = $bilang_bln * $array_upah['ujrah']; + $onepercent = $bilang_bln * $array_upah['onepercent']; + + + $ujrah_semasa_round = number_format($ujrah,2); + if(strpos($ujrah_semasa_round,',')){ + $ujrah_semasa_round = str_replace(',','',$ujrah_semasa_round); + } + $ujrah_semasa = substr($ujrah_semasa_round, 0, -1); + if(strpos($ujrah_semasa,',')){ + $ujrah_semasa = str_replace(',','',$ujrah_semasa); + } + + $onepercent_semasa_round = number_format($onepercent,2); + if(strpos($onepercent_semasa_round,',')){ + $onepercent_semasa_round = str_replace(',','',$onepercent_semasa_round); + } + $onepercent_semasa = substr($onepercent_semasa_round, 0, -1); + if(strpos($onepercent_semasa,',')){ + $onepercent_semasa = str_replace(',','',$onepercent_semasa); + } + + return ['ujrah' => $ujrah_semasa, 'onepercent' => $onepercent_semasa]; + } + + public function kiraupahUjrahOnePercentRebate($kodcaw,$norujukan){ + $onepercentservices = new OnePercentServices(); + + $cawangan = Cawangan::on('mysql7') + ->where('kodcaw','=',$kodcaw) + ->first(); + + $gadai_data = Gadai::on($cawangan['mysql']) + ->where('norujukan','=',$norujukan) + ->first(); + + if($gadai_data['tempoh'] >= 12.0){ + $tempoh = 12; + }else{ + $tempoh = $gadai_data['tempoh']; + } + + $bilang_bln = $tempoh - $gadai_data['tempohbayar']; + $array_upah = $onepercentservices->kiraanKeuntunganSebenar($gadai_data['bakipjm'],$gadai_data['nilaimarhun'],$gadai_data['kadarupah'],$gadai_data['margin_semasa']); + $ujrah = $bilang_bln * $array_upah['ujrah']; + $onepercent = $bilang_bln * $array_upah['onepercent']; + + + $ujrah_semasa_round = number_format($ujrah,2); + if(strpos($ujrah_semasa_round,',')){ + $ujrah_semasa_round = str_replace(',','',$ujrah_semasa_round); + } + $ujrah_semasa = substr($ujrah_semasa_round, 0, -1); + if(strpos($ujrah_semasa,',')){ + $ujrah_semasa = str_replace(',','',$ujrah_semasa); + } + + $onepercent_semasa_round = number_format($onepercent,2); + if(strpos($onepercent_semasa_round,',')){ + $onepercent_semasa_round = str_replace(',','',$onepercent_semasa_round); + } + $onepercent_semasa = substr($onepercent_semasa_round, 0, -1); + if(strpos($onepercent_semasa,',')){ + $onepercent_semasa = str_replace(',','',$onepercent_semasa); + } + + return ['ujrah' => $ujrah_semasa, 'onepercent' => $onepercent_semasa]; + } + + + } diff --git a/routes/web.php b/routes/web.php index 7250486..0842c8d 100644 --- a/routes/web.php +++ b/routes/web.php @@ -106,8 +106,8 @@ $router->group(['prefix'=>'api'], function () use ($router){ //Tebus API $router->get('tebustawarruq/{kodcaw}/{norujukan}',['uses'=>'TebusController@tebusTawarruq']); - $router->get('upahtawarruq/{kodcaw}/{norujukan}',['uses'=>'TebusController@upahTawarruq']); - $router->get('upahrebettawarruq/{kodcaw}/{norujukan}',['uses'=>'TebusController@upahRebetTawarruq']); + $router->get('upahtawarruq/{kodcaw}/{norujukan}/{jeniskeuntungan}',['uses'=>'TebusController@upahTawarruq']); + $router->get('upahrebettawarruq/{kodcaw}/{norujukan}/{jeniskeuntungan}',['uses'=>'TebusController@upahRebetTawarruq']); $router->get('tebusseparuhtawarruq/{kodcaw}/{norujukan}',['uses'=>'TebusController@tebusSeparuhTawarruq']); $router->get('tebusseparuhbukantawarruq/{kodcaw}/{norujukan}',['uses'=>'TebusController@tebusSeparuhNotTawarruq']); $router->get('tebusbukantawarruq/{kodcaw}/{norujukan}',['uses'=>'TebusController@tebusNotTawarruq']); From 729aa6bf2950b8f8daecf39e27b656e20f5702ba Mon Sep 17 00:00:00 2001 From: Hafifie PKB Date: Thu, 16 Nov 2023 10:20:55 +0800 Subject: [PATCH 2/5] add seeder for kadarupah --- app/KadarUpah.php | 1 + database/seeds/KadarUpahSeeder.php | 30 ++++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 database/seeds/KadarUpahSeeder.php diff --git a/app/KadarUpah.php b/app/KadarUpah.php index fa897d6..4170fd9 100644 --- a/app/KadarUpah.php +++ b/app/KadarUpah.php @@ -9,6 +9,7 @@ class KadarUpah extends Model protected $table = 'kadarupah'; protected $connection = 'mysql7'; + public $timestamps = false; /** * The attributes that are mass assignable. * diff --git a/database/seeds/KadarUpahSeeder.php b/database/seeds/KadarUpahSeeder.php new file mode 100644 index 0000000..4137c44 --- /dev/null +++ b/database/seeds/KadarUpahSeeder.php @@ -0,0 +1,30 @@ +where('kadarupdah', '=', 1.20)->update([ + 'kadarujrah' => 0.14, + 'kadaronepercent' => 1, + ]); + + KadarUpah::on('mysql7')->where('kadarupdah', '=', 1.50)->update([ + 'kadarujrah' => 0.40, + 'kadaronepercent' => 1, + ]); + + KadarUpah::on('mysql7')->where('kadarupdah', '=', 1.70)->update([ + 'kadarujrah' => 0.56, + 'kadaronepercent' => 1, + ]); + } +} From 0b58baefe556a0ce933362f534f756adf48459a6 Mon Sep 17 00:00:00 2001 From: Hafifie PKB Date: Thu, 16 Nov 2023 14:34:28 +0800 Subject: [PATCH 3/5] add migration script --- app/Console/Commands/MigrationOnePercent.php | 49 ++++++++++++++++++ app/Console/Commands/TestOnePercent.php | 54 -------------------- app/Console/Kernel.php | 2 +- 3 files changed, 50 insertions(+), 55 deletions(-) create mode 100644 app/Console/Commands/MigrationOnePercent.php delete mode 100644 app/Console/Commands/TestOnePercent.php diff --git a/app/Console/Commands/MigrationOnePercent.php b/app/Console/Commands/MigrationOnePercent.php new file mode 100644 index 0000000..1aff5b2 --- /dev/null +++ b/app/Console/Commands/MigrationOnePercent.php @@ -0,0 +1,49 @@ + 'KadarUpahSeeder', + ]); + + $this->info('The command was successfully generated!'); + } +} \ No newline at end of file diff --git a/app/Console/Commands/TestOnePercent.php b/app/Console/Commands/TestOnePercent.php deleted file mode 100644 index 5d8af0a..0000000 --- a/app/Console/Commands/TestOnePercent.php +++ /dev/null @@ -1,54 +0,0 @@ -onepercentserv = $onepercentserv; - parent::__construct(); - } - - /** - * Execute the console command. - * - * @return int - */ - public function handle() - { - $pemb = $this->ask('Pembiayaan?'); - $nm = $this->ask('Nilaimarhun?'); - $ku = $this->ask('Kadarujrah?'); - $marg = $this->ask('Margin?'); - - $test = $this->onepercentserv->kiraanKeuntunganSebenar($pemb,$nm,$ku,$marg); - - dd($test); - return $test; - } -} \ No newline at end of file diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php index e18917f..3fe6529 100644 --- a/app/Console/Kernel.php +++ b/app/Console/Kernel.php @@ -18,7 +18,7 @@ class Kernel extends ConsoleKernel */ protected $commands = [ Commands\DailyGadai::class, - Commands\TestOnePercent::class, + Commands\MigrationOnePercent::class, ]; From 1e890b2b17957f136b6a0d928124cbc54749e009 Mon Sep 17 00:00:00 2001 From: Hafifie PKB Date: Tue, 21 Nov 2023 12:32:25 +0800 Subject: [PATCH 4/5] fix model tebus added ujrah and onepercent, also, fix upah from 0.14 to 0.16 --- app/Tebus.php | 2 ++ database/seeds/KadarUpahSeeder.php | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/app/Tebus.php b/app/Tebus.php index 63531bb..4d01786 100644 --- a/app/Tebus.php +++ b/app/Tebus.php @@ -51,6 +51,8 @@ class Tebus extends Model 'historygadaian', 'pinjamanterkini', 'tarikhbyrn', + 'ujrah', + 'onepercent' ]; /** diff --git a/database/seeds/KadarUpahSeeder.php b/database/seeds/KadarUpahSeeder.php index 4137c44..c4a37ee 100644 --- a/database/seeds/KadarUpahSeeder.php +++ b/database/seeds/KadarUpahSeeder.php @@ -13,7 +13,7 @@ class KadarUpahSeeder extends Seeder public function run() { KadarUpah::on('mysql7')->where('kadarupdah', '=', 1.20)->update([ - 'kadarujrah' => 0.14, + 'kadarujrah' => 0.16, 'kadaronepercent' => 1, ]); From ff5082d74d630630a93264c370940aa5746e7b3c Mon Sep 17 00:00:00 2001 From: Hafifie PKB Date: Tue, 21 Nov 2023 14:18:22 +0800 Subject: [PATCH 5/5] added log in transaction ansuran --- app/Http/Controllers/GadaiController.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/GadaiController.php b/app/Http/Controllers/GadaiController.php index f16f5e8..e443a22 100644 --- a/app/Http/Controllers/GadaiController.php +++ b/app/Http/Controllers/GadaiController.php @@ -33,6 +33,7 @@ use App\InOutMar; use Illuminate\Http\Request; use App\Services\OnePercentServices; +use Log; use Illuminate\Support\Facades\DB; @@ -564,12 +565,14 @@ class GadaiController extends Controller } DB::commit(); - return response()->json("success", 200); }); }catch(\Exception $e){ + Log::error("Transaction failed: " . $e->getMessage()); return response()->json("Transaction failed: " . $e->getMessage(),500); } + + return response()->json("success",200); } public function getGadaianSemasa($kodcaw){