Skip to content

A free open source IT asset/license management system

Added to seeders/factories

snipe9f247364e0b7
diff --git a/database/factories/CustomFieldFactory.php b/database/factories/CustomFieldFactory.php
index 966012c71d..2264232261 100644
--- a/database/factories/CustomFieldFactory.php
+++ b/database/factories/CustomFieldFactory.php
@@ -155,6 +155,35 @@ class CustomFieldFactory extends Factory
});
}
+ public function testDate()
+ {
+ return $this->state(function () {
+ return [
+ 'name' => 'Sample Date',
+ 'help_text' => 'This shows a datepicker',
+ // element must be one of text/listbox/textarea/markdown-
+ // textarea/checkbox/radio; the date widget is picked by
+ // format, not element.
+ 'element' => 'text',
+ 'format' => 'DATE',
+ ];
+ });
+ }
+
+ public function testDatetime()
+ {
+ return $this->state(function () {
+ return [
+ 'name' => 'Sample Datetime',
+ 'help_text' => 'This shows a datetimepicker',
+ // Same story as testDate: element stays 'text', the
+ // datetimepicker fires when format == 'DATETIME'.
+ 'element' => 'text',
+ 'format' => 'DATETIME',
+ ];
+ });
+ }
+
public function testMarkdownTextarea()
{
return $this->state(function () {
diff --git a/database/seeders/CustomFieldSeeder.php b/database/seeders/CustomFieldSeeder.php
index 6085acdd70..f4d76ef331 100644
--- a/database/seeders/CustomFieldSeeder.php
+++ b/database/seeders/CustomFieldSeeder.php
@@ -37,6 +37,8 @@ class CustomFieldSeeder extends Seeder
CustomField::factory()->count(1)->testCheckbox()->create();
CustomField::factory()->count(1)->testRadio()->create();
CustomField::factory()->count(1)->testMarkdownTextarea()->create();
+ CustomField::factory()->count(1)->testDate()->create();
+ CustomField::factory()->count(1)->testDatetime()->create();
CustomField::factory()->count(1)->xss()->create();
DB::table('custom_field_custom_fieldset')->insert([
@@ -125,6 +127,34 @@ class CustomFieldSeeder extends Seeder
'required' => 0,
],
+ [
+ 'custom_field_id' => '10',
+ 'custom_fieldset_id' => '1',
+ 'order' => 0,
+ 'required' => 0,
+ ],
+
+ [
+ 'custom_field_id' => '11',
+ 'custom_fieldset_id' => '1',
+ 'order' => 0,
+ 'required' => 0,
+ ],
+
+ [
+ 'custom_field_id' => '10',
+ 'custom_fieldset_id' => '2',
+ 'order' => 0,
+ 'required' => 0,
+ ],
+
+ [
+ 'custom_field_id' => '11',
+ 'custom_fieldset_id' => '2',
+ 'order' => 0,
+ 'required' => 0,
+ ],
+
]);
}
}