1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-14 15:13:29 +01:00
invoiceninja/database/seeds/InvoiceStatusSeeder.php
2017-01-30 18:05:31 +02:00

38 lines
894 B
PHP

<?php
use App\Models\InvoiceStatus;
class InvoiceStatusSeeder extends Seeder
{
public function run()
{
Eloquent::unguard();
$this->createInvoiceStatuses();
Eloquent::reguard();
}
private function createInvoiceStatuses()
{
$statuses = [
['id' => '1', 'name' => 'Draft'],
['id' => '2', 'name' => 'Sent'],
['id' => '3', 'name' => 'Viewed'],
['id' => '4', 'name' => 'Approved'],
['id' => '5', 'name' => 'Partial'],
['id' => '6', 'name' => 'Paid'],
];
foreach ($statuses as $status) {
$record = InvoiceStatus::find($status['id']);
if ($record) {
$record->name = $status['name'];
$record->save();
} else {
InvoiceStatus::create($status);
}
}
}
}