mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-09 20:52:56 +01:00
Add check for duplicate id in design seeder
This commit is contained in:
parent
7696ba610c
commit
a6aa59ac2f
@ -41,12 +41,16 @@ class InvoiceDesignsSeeder extends Seeder
|
||||
|
||||
for ($i = 1; $i <= 3; $i++) {
|
||||
$name = 'Custom' . $i;
|
||||
if (! InvoiceDesign::whereName($name)->first()) {
|
||||
InvoiceDesign::create([
|
||||
'id' => $i + 10,
|
||||
'name' => $name,
|
||||
]);
|
||||
$id = $i + 10;
|
||||
|
||||
if (InvoiceDesign::whereName($name)->orWhere('id', '=', $id)->first()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
InvoiceDesign::create([
|
||||
'id' => $id,
|
||||
'name' => $name,
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user