state(function (array $attributes) use ($field, $methodName, $param) { $states[$field] = call_user_func_array([static::class, $methodName], $param); return $states; }); } protected function __null($field = null) { return null; } protected function __string($field = null, $length = 16): string { return Str::random($length); } protected function __gtString($field = null, $min = 256) { return $this->__string($field, rand($min + 1, $min + 1000)); } protected function __ltString($field = null, $max = 3) { return $this->__string($field, $max - 1); } protected function __unique($field) { return $this->model::factory()->createQuietly()->{$field}; } protected function __numeric($field) { return rand(100, 200); } protected function __lt($field = null, $max = 4) { return rand($max - 100, $max - 1); } protected function __gt($field = null, $min = 4) { return rand($min + 1, $min + 100); } public function withDependency() { return $this->state(function (array $attributes) { return $this->dependencyProvider(); }); } }