From a0f3e298b3bc2ccbdfe7de2da8c384a3dcc7e71b Mon Sep 17 00:00:00 2001 From: Hafifie PKB Date: Tue, 20 Feb 2024 15:50:25 +0800 Subject: [PATCH] add tag_tebus in gadai --- app/Http/Controllers/GadaiController.php | 3 +- ...24_02_20_092545_add_tag_tebus_to_gadai.php | 61 +++++++++++++++++++ 2 files changed, 63 insertions(+), 1 deletion(-) create mode 100644 database/migrations/2024_02_20_092545_add_tag_tebus_to_gadai.php diff --git a/app/Http/Controllers/GadaiController.php b/app/Http/Controllers/GadaiController.php index 2fba4ab..597b415 100644 --- a/app/Http/Controllers/GadaiController.php +++ b/app/Http/Controllers/GadaiController.php @@ -1131,7 +1131,8 @@ class GadaiController extends Controller $updatehistory = Gadai::on($cawangan['mysql']) ->where('norujukan','=',$norujukan) ->update(array( - 'historygadaian' => $request->historygadaian + 'historygadaian' => $request->historygadaian, + 'tag_tebus' => $request->jenistebus, )); return response()->json($updatehistory,200); diff --git a/database/migrations/2024_02_20_092545_add_tag_tebus_to_gadai.php b/database/migrations/2024_02_20_092545_add_tag_tebus_to_gadai.php new file mode 100644 index 0000000..af67d3e --- /dev/null +++ b/database/migrations/2024_02_20_092545_add_tag_tebus_to_gadai.php @@ -0,0 +1,61 @@ +getPdo(); + return true; + } catch(\Exception $e){ + Log::info($connection); + return false; + } + }); + return $db_connection; + } + + public function up() + { + $db_connection = $this->getActiveDB(); + + foreach($db_connection as $dbase){ + Schema::connection($dbase)->table('gadai', function (Blueprint $table) use($dbase) { + + $isTagTebus = Schema::connection($dbase)->hasColumn('gadai', 'tag_tebus'); + + if(! $isTagTebus){ + $table->char('tag_tebus', 2); + } + + }); + } + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('gadai', function (Blueprint $table) { + // + }); + } +}