invoiceninja/database/seeds/PaymentTypesSeeder.php
David Bomba eddb9adc73
Client Settings (#2668)
* Clean up Client Show

* Working on Show Client menu action

* working on client view permissions

* Finishing up Client Statement View

* Workig on client settings

* add mix manifest

* css for client settings

* Client Settings

* Working on Client Settings

* Implement StartupCheck and static seeders

* Implement cached statics in view composers

* Working on client settings

* Payment Terms

* Working on Payment Terms View Composer

* Payment Terms builder

* Client Settings

* refactor companies table

* Refactor for company settings, move settings to json

* Set object cast on settings column of Company table

* Fixes for refactor of companies and clients table

* Test

* Client Settings Datamapper

* Client Settings

* Default client language

* Client Settings

* Working on client settings options

* Client Settings

* Settings Json serialization/deserialization handling
2019-02-17 21:34:46 +11:00

61 lines
3.0 KiB
PHP

<?php
use App\Models\PaymentType;
use Illuminate\Database\Seeder;
class PaymentTypesSeeder extends Seeder
{
public function run()
{
Eloquent::unguard();
$paymentTypes = [
['name' => 'Apply Credit'],
['name' => 'Bank Transfer', 'gateway_type_id' => GATEWAY_TYPE_BANK_TRANSFER],
['name' => 'Cash'],
['name' => 'Debit', 'gateway_type_id' => GATEWAY_TYPE_CREDIT_CARD],
['name' => 'ACH', 'gateway_type_id' => GATEWAY_TYPE_BANK_TRANSFER],
['name' => 'Visa Card', 'gateway_type_id' => GATEWAY_TYPE_CREDIT_CARD],
['name' => 'MasterCard', 'gateway_type_id' => GATEWAY_TYPE_CREDIT_CARD],
['name' => 'American Express', 'gateway_type_id' => GATEWAY_TYPE_CREDIT_CARD],
['name' => 'Discover Card', 'gateway_type_id' => GATEWAY_TYPE_CREDIT_CARD],
['name' => 'Diners Card', 'gateway_type_id' => GATEWAY_TYPE_CREDIT_CARD],
['name' => 'EuroCard', 'gateway_type_id' => GATEWAY_TYPE_CREDIT_CARD],
['name' => 'Nova', 'gateway_type_id' => GATEWAY_TYPE_CREDIT_CARD],
['name' => 'Credit Card Other', 'gateway_type_id' => GATEWAY_TYPE_CREDIT_CARD],
['name' => 'PayPal', 'gateway_type_id' => GATEWAY_TYPE_PAYPAL],
['name' => 'Google Wallet'],
['name' => 'Check'],
['name' => 'Carte Blanche', 'gateway_type_id' => GATEWAY_TYPE_CREDIT_CARD],
['name' => 'UnionPay', 'gateway_type_id' => GATEWAY_TYPE_CREDIT_CARD],
['name' => 'JCB', 'gateway_type_id' => GATEWAY_TYPE_CREDIT_CARD],
['name' => 'Laser', 'gateway_type_id' => GATEWAY_TYPE_CREDIT_CARD],
['name' => 'Maestro', 'gateway_type_id' => GATEWAY_TYPE_CREDIT_CARD],
['name' => 'Solo', 'gateway_type_id' => GATEWAY_TYPE_CREDIT_CARD],
['name' => 'Switch', 'gateway_type_id' => GATEWAY_TYPE_CREDIT_CARD],
['name' => 'iZettle', 'gateway_type_id' => GATEWAY_TYPE_CREDIT_CARD],
['name' => 'Swish', 'gateway_type_id' => GATEWAY_TYPE_BANK_TRANSFER],
['name' => 'Venmo'],
['name' => 'Money Order'],
['name' => 'Alipay', 'gateway_type_id' => GATEWAY_TYPE_ALIPAY],
['name' => 'Sofort', 'gateway_type_id' => GATEWAY_TYPE_SOFORT],
['name' => 'SEPA', 'gateway_type_id' => GATEWAY_TYPE_SEPA],
['name' => 'GoCardless', 'gateway_type_id' => GATEWAY_TYPE_GOCARDLESS],
['name' => 'Bitcoin', 'gateway_type_id' => GATEWAY_TYPE_BITCOIN],
];
foreach ($paymentTypes as $paymentType) {
$record = PaymentType::where('name', '=', $paymentType['name'])->first();
if ($record) {
$record->name = $paymentType['name'];
$record->gateway_type_id = ! empty($paymentType['gateway_type_id']) ? $paymentType['gateway_type_id'] : null;
$record->save();
} else {
PaymentType::create($paymentType);
}
}
}
}