invoiceninja/database/seeds/GatewayTypesSeeder.php

41 lines
1.4 KiB
PHP
Raw Normal View History

2016-09-15 13:41:09 +03:00
<?php
use App\Models\GatewayType;
class GatewayTypesSeeder extends Seeder
{
public function run()
{
Eloquent::unguard();
2018-07-08 15:08:02 +03:00
// fix for legacy data
DB::statement('UPDATE gateway_types SET alias = "custom1" WHERE id = 6');
2016-09-15 13:41:09 +03:00
$gateway_types = [
['alias' => 'credit_card', 'name' => 'Credit Card'],
['alias' => 'bank_transfer', 'name' => 'Bank Transfer'],
['alias' => 'paypal', 'name' => 'PayPal'],
['alias' => 'bitcoin', 'name' => 'Bitcoin'],
['alias' => 'dwolla', 'name' => 'Dwolla'],
2018-04-13 16:48:07 +03:00
['alias' => 'custom1', 'name' => 'Custom'],
2017-09-04 13:14:58 +03:00
['alias' => 'alipay', 'name' => 'Alipay'],
2017-09-05 21:53:52 +03:00
['alias' => 'sofort', 'name' => 'Sofort'],
['alias' => 'sepa', 'name' => 'SEPA'],
['alias' => 'gocardless', 'name' => 'GoCardless'],
2017-11-27 16:50:06 +02:00
['alias' => 'apple_pay', 'name' => 'Apple Pay'],
2018-04-13 16:48:07 +03:00
['alias' => 'custom2', 'name' => 'Custom'],
['alias' => 'custom3', 'name' => 'Custom'],
2016-09-15 13:41:09 +03:00
];
foreach ($gateway_types as $gateway_type) {
2018-04-13 16:48:07 +03:00
$record = GatewayType::where('alias', '=', $gateway_type['alias'])->first();
2018-04-25 09:41:55 +03:00
if ($record) {
$record->fill($gateway_type);
$record->save();
} else {
2016-09-15 13:41:09 +03:00
GatewayType::create($gateway_type);
}
}
}
}