mirror of
https://github.com/snipe/snipe-it.git
synced 2026-08-18 03:06:23 +00:00
Added to seeders/factories
This commit is contained in:
@ -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 () {
|
||||
|
||||
@ -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,
|
||||
],
|
||||
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user