mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 05:02:36 +01:00
Gateway Types
This commit is contained in:
parent
bad61e8984
commit
cc1997b390
@ -15,5 +15,7 @@ use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Gateway extends Model
|
||||
{
|
||||
//
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
26
app/Models/GatewayType.php
Normal file
26
app/Models/GatewayType.php
Normal 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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -29,6 +29,7 @@ class DatabaseSeeder extends Seeder
|
||||
$this->call('CountriesSeeder');
|
||||
$this->call('IndustrySeeder');
|
||||
$this->call('PaymentTypesSeeder');
|
||||
$this->call('GatewaySeeder');
|
||||
|
||||
}
|
||||
}
|
||||
|
37
database/seeds/GatewayTypesSeeder.php
Normal file
37
database/seeds/GatewayTypesSeeder.php
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user