From 977e28d8839cf756bd96237418efb6e77d180b08 Mon Sep 17 00:00:00 2001 From: Hafifie PKB Date: Sat, 2 Dec 2023 23:55:24 +0800 Subject: [PATCH] add duit pelanggan --- app/Http/Controllers/GadaiController.php | 4 ++- app/Http/Controllers/TebusController.php | 6 +++- app/Transaction.php | 2 +- ...add_duitpelanggan_to_transaction_table.php | 33 +++++++++++++++++++ 4 files changed, 42 insertions(+), 3 deletions(-) create mode 100644 database/migrations/2023_12_02_200032_add_duitpelanggan_to_transaction_table.php diff --git a/app/Http/Controllers/GadaiController.php b/app/Http/Controllers/GadaiController.php index 2cb0be0..043337a 100644 --- a/app/Http/Controllers/GadaiController.php +++ b/app/Http/Controllers/GadaiController.php @@ -507,7 +507,9 @@ class GadaiController extends Controller 'duit_masuk' => $request->bayaran, 'created_at' => $current, 'bakiharga' => $baki_hargajualan, - 'nowakil' => (int)$request->nowakil + 'nowakil' => (int)$request->nowakil, + 'duitpelanggan' => $request->duitpelanggan, + 'bakipelanggan' => $request->bakipelanggan ]); if($gadai['tempoh'] >= 12.0){ diff --git a/app/Http/Controllers/TebusController.php b/app/Http/Controllers/TebusController.php index 611b1dd..0baf7c8 100644 --- a/app/Http/Controllers/TebusController.php +++ b/app/Http/Controllers/TebusController.php @@ -581,7 +581,9 @@ class TebusController extends Controller 'duit_masuk' => $harga_tebus, 'created_at' => $current, 'bakiharga' => $baki_hargajualan, - 'nowakil' => (int)$request->nowakil + 'nowakil' => (int)$request->nowakil, + 'duitpelanggan' => $request->duitpelanggan, + 'bakipelanggan' => $request->bakipelanggan ]); } @@ -696,6 +698,8 @@ class TebusController extends Controller 'duit_masuk' => $request->totalbayaran, 'created_at' => $current, 'bakiharga' => 0, + 'duitpelanggan' => $request->bayaranpelanggan, + 'bakipelanggan' => $request->bakipelanggan ]); $audit = new Audit(); diff --git a/app/Transaction.php b/app/Transaction.php index 0dfd13e..56a8692 100644 --- a/app/Transaction.php +++ b/app/Transaction.php @@ -14,7 +14,7 @@ class Transaction extends Model * @var array */ protected $fillable = [ - 'trans_type','norujukan','nokp','teller','kodcaw','duit_masuk','duit_keluar','created_at','bakiharga','nowakil' + 'trans_type','norujukan','nokp','teller','kodcaw','duit_masuk','duit_keluar','created_at','bakiharga','nowakil','duitpelanggan','bakipelanggan' ]; /** diff --git a/database/migrations/2023_12_02_200032_add_duitpelanggan_to_transaction_table.php b/database/migrations/2023_12_02_200032_add_duitpelanggan_to_transaction_table.php new file mode 100644 index 0000000..ab452ac --- /dev/null +++ b/database/migrations/2023_12_02_200032_add_duitpelanggan_to_transaction_table.php @@ -0,0 +1,33 @@ +table('transaction', function (Blueprint $table) { + $table->decimal('duitpelanggan', 9, 2); + $table->decimal('bakipelanggan', 9, 2); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::connection('mysql7')->table('transaction', function (Blueprint $table) { + $table->dropColumn(['duitpelanggan','bakipelanggan']); + }); + } +}