1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-14 15:13:29 +01:00
invoiceninja/database/seeds/PaymentStatusSeeder.php

38 lines
917 B
PHP
Raw Normal View History

2016-04-23 22:40:19 +02:00
<?php
use App\Models\PaymentStatus;
class PaymentStatusSeeder extends Seeder
{
public function run()
{
Eloquent::unguard();
$this->createPaymentStatuses();
Eloquent::reguard();
}
private function createPaymentStatuses()
{
$statuses = [
['id' => '1', 'name' => 'Pending'],
2016-05-06 23:05:42 +02:00
['id' => '2', 'name' => 'Voided'],
['id' => '3', 'name' => 'Failed'],
['id' => '4', 'name' => 'Completed'],
['id' => '5', 'name' => 'Partially Refunded'],
['id' => '6', 'name' => 'Refunded'],
2016-04-23 22:40:19 +02:00
];
foreach ($statuses as $status) {
$record = PaymentStatus::find($status['id']);
if ($record) {
$record->name = $status['name'];
$record->save();
} else {
PaymentStatus::create($status);
}
}
}
}