mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-18 09:04:35 +01:00
39 lines
898 B
PHP
39 lines
898 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);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|