Add fakers for fields
This commit is contained in:
parent
d4c8fdff3f
commit
d597d5ea2b
|
@ -26,6 +26,9 @@ class CheckboxField extends Field
|
||||||
|
|
||||||
public static function fake(Generator $faker): array
|
public static function fake(Generator $faker): array
|
||||||
{
|
{
|
||||||
return [];
|
return [
|
||||||
|
'description' => $faker->text(),
|
||||||
|
'required' => $faker->boolean(),
|
||||||
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,8 @@ class CheckboxesField extends Field
|
||||||
|
|
||||||
public static function fake(Generator $faker): array
|
public static function fake(Generator $faker): array
|
||||||
{
|
{
|
||||||
return [];
|
return [
|
||||||
|
'options' => $faker->words(4),
|
||||||
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,9 @@ class DropdownField extends Field
|
||||||
|
|
||||||
public static function fake(Generator $faker): array
|
public static function fake(Generator $faker): array
|
||||||
{
|
{
|
||||||
return [];
|
return [
|
||||||
|
'options' => $faker->words(4),
|
||||||
|
'required' => $faker->boolean(),
|
||||||
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,9 @@ class RadioField extends Field
|
||||||
|
|
||||||
public static function fake(Generator $faker): array
|
public static function fake(Generator $faker): array
|
||||||
{
|
{
|
||||||
return [];
|
return [
|
||||||
|
'options' => $faker->words(4),
|
||||||
|
'required' => $faker->boolean(),
|
||||||
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,9 @@ class TextareaField extends Field
|
||||||
|
|
||||||
public static function fake(Generator $faker): array
|
public static function fake(Generator $faker): array
|
||||||
{
|
{
|
||||||
return [];
|
return [
|
||||||
|
'rows' => $faker->numberBetween(5, 10),
|
||||||
|
'required' => $faker->boolean(),
|
||||||
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,12 +22,14 @@ class FormtemplateFieldRequest extends RequestFactory
|
||||||
*/
|
*/
|
||||||
public function definition(): array
|
public function definition(): array
|
||||||
{
|
{
|
||||||
|
$type = $this->faker->randomElement(array_column(Field::asMeta(), 'id'));
|
||||||
return [
|
return [
|
||||||
'name' => $this->faker->words(5, true),
|
'name' => $this->faker->words(5, true),
|
||||||
'key' => str($this->faker->words(5, true))->snake()->toString(),
|
'key' => str($this->faker->words(5, true))->snake()->toString(),
|
||||||
'type' => $this->faker->randomElement(array_column(Field::asMeta(), 'id')),
|
'type' => $type,
|
||||||
'columns' => ['mobile' => 2, 'tablet' => 4, 'desktop' => 6],
|
'columns' => ['mobile' => 2, 'tablet' => 4, 'desktop' => 6],
|
||||||
'default' => '',
|
'default' => '',
|
||||||
|
...Field::classFromType($type)::fake($this->faker),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue