$options) * @method self maxToday(bool $maxToday) * @method self parentGroup(int $groupId) * @method self parentField(string $fieldKey) * @method self namiType(?NamiType $type) * @method self forMembers(bool $forMembers) * @method self specialType(SpecialType $specialType) */ class FormtemplateFieldRequest extends RequestFactory { /** * @return array */ public function definition(): array { return [ 'name' => $this->faker->words(5, true), 'key' => str($this->faker->words(5, true))->snake()->toString(), 'columns' => ['mobile' => 2, 'tablet' => 4, 'desktop' => 6], 'nami_type' => null, 'for_members' => true, ]; } /** * @param string|class-string $field */ public static function type(string $field): self { if (!$field || !class_exists($field)) { return self::new(['type' => $field]); } return self::new([ 'type' => $field::type(), 'value' => $field::default(), ...$field::fake((new static())->faker), ]); } /** * @param mixed $args */ public function __call(string $method, $args): self { return $this->state([(string) str($method)->snake() => $args[0]]); } }