1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 05:02:36 +01:00

Gateway Types

This commit is contained in:
David Bomba 2019-08-22 10:25:30 +10:00
parent bad61e8984
commit cc1997b390
4 changed files with 67 additions and 1 deletions

View File

@ -15,5 +15,7 @@ use Illuminate\Database\Eloquent\Model;
class Gateway extends Model
{
//
}

View File

@ -0,0 +1,26 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com)
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2019. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace App\Models;
use App\Models\Gateway;
use Illuminate\Database\Eloquent\Model;
class GatewayType extends Model
{
public function gateway()
{
return $this->belongsTo(Gateway::class);
}
}

View File

@ -29,6 +29,7 @@ class DatabaseSeeder extends Seeder
$this->call('CountriesSeeder');
$this->call('IndustrySeeder');
$this->call('PaymentTypesSeeder');
$this->call('GatewaySeeder');
}
}

View File

@ -0,0 +1,37 @@
<?php
use App\Models\GatewayType;
class GatewayTypesSeeder extends Seeder
{
public function run()
{
Eloquent::unguard();
$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'],
['alias' => 'custom1', 'name' => 'Custom'],
['alias' => 'alipay', 'name' => 'Alipay'],
['alias' => 'sofort', 'name' => 'Sofort'],
['alias' => 'sepa', 'name' => 'SEPA'],
['alias' => 'gocardless', 'name' => 'GoCardless'],
['alias' => 'apple_pay', 'name' => 'Apple Pay'],
['alias' => 'custom2', 'name' => 'Custom'],
['alias' => 'custom3', 'name' => 'Custom'],
];
foreach ($gateway_types as $gateway_type) {
$record = GatewayType::where('alias', '=', $gateway_type['alias'])->first();
if ($record) {
$record->fill($gateway_type);
$record->save();
} else {
GatewayType::create($gateway_type);
}
}
}
}