Marwam Malta
Increase a select's option by the amount of reapeater in the form
I managed to get here
"->addAction(function($set, $get) {
self::generateDependencyClassOptions($set, $get('rules_category_dependents.dependent_category'));
})"
"public static function generateDependencyClassOptions($set, $dependentCategories)
{
$dependencyClassOptions = [
'1C' => '1ª classe',
'2C' => '2ª classe',
'3C' => '3ª classe',
'4C' => '4ª classe',
];
$repeaterCount = is_array($dependentCategories) ? count($dependentCategories) : 0;
// dd($repeaterCount, $dependencyClassOptions);
if ($repeaterCount > 4) {
for ($i = 5; $i <= $repeaterCount; $i++) {
$dependencyClassOptions["{$i}C"] = "{$i}ª classe";
}
dd($dependencyClassOptions);
}
$set('dynamic_options', $dependencyClassOptions);
}"
even in "dd()" it mounts but I'm not able to set it in the selects
2 replies