diff --git a/database/migrations/2024_06_11_231143_add_rotessa_gateway.php b/database/migrations/2024_06_11_231143_add_rotessa_gateway.php index eaade6bb4357..cb18062b40e0 100644 --- a/database/migrations/2024_06_11_231143_add_rotessa_gateway.php +++ b/database/migrations/2024_06_11_231143_add_rotessa_gateway.php @@ -15,35 +15,23 @@ return new class extends Migration public function up(): void { Model::unguard(); - \DB::statement('SET FOREIGN_KEY_CHECKS=0;'); - $record = Gateway::where('name', '=', 'Rotessa')->first(); - $count = (int) Gateway::count(); - - $configuration = new \stdClass; - $configuration->api_key = ''; - $configuration->test_mode = true; - - if (!$record) { - $gateway = new Gateway; - } else { - $gateway = $record; + if(!Gateway::find(63)) { + $configuration = new \stdClass; + $configuration->api_key = ''; + $configuration->test_mode = true; + + $gateway->id = 63; + $gateway->name = 'Rotessa'; + $gateway->key = '91be24c7b792230bced33e930ac61676'; + $gateway->provider = 'Rotessa'; + $gateway->is_offsite = true; + $gateway->fields = \json_encode($configuration); + $gateway->visible = 1; + $gateway->site_url = "https://rotessa.com"; + $gateway->default_gateway_type_id = 2; + $gateway->save(); } - - $gateway->id = 4002; - $gateway->name = 'Rotessa'; - $gateway->key = Str::lower(Str::random(32)); - $gateway->provider = 'Rotessa'; - $gateway->is_offsite = true; - $gateway->fields = \json_encode($configuration); - $gateway->visible = 1; - $gateway->site_url = "https://rotessa.com"; - $gateway->default_gateway_type_id = 2; - $gateway->save(); - - Gateway::query()->where('name','=', 'Rotessa')->update(['visible' => 1]); - - \DB::statement('SET FOREIGN_KEY_CHECKS=1;'); } /**