adrema/app/Form/Fields/CheckboxesField.php

33 lines
615 B
PHP
Raw Normal View History

2023-12-26 01:05:45 +01:00
<?php
namespace App\Form\Fields;
2023-12-26 20:06:57 +01:00
use Faker\Generator;
2023-12-26 01:05:45 +01:00
class CheckboxesField extends Field
{
public static function name(): string
{
return 'Checkboxes';
}
public static function meta(): array
{
return [
2023-12-26 20:20:32 +01:00
['key' => 'options', 'default' => [], 'rules' => ['options' => 'array', 'options.*' => 'required|string'], 'label' => 'Optionen'],
2023-12-26 01:05:45 +01:00
];
}
public static function default()
{
return [];
}
2023-12-26 20:06:57 +01:00
public static function fake(Generator $faker): array
{
2023-12-27 22:39:23 +01:00
return [
'options' => $faker->words(4),
];
2023-12-26 20:06:57 +01:00
}
2023-12-26 01:05:45 +01:00
}