This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

saleh.asadi.work19498
saleh.asadi.work19498

Can I have nested select options in October !? if yes, how can I handle it !? Thanks.

MarvinDurot
MarvinDurot

You can!

First the nested model must use the SimpleTree or NestedTree trait.

Then write a new method on the model used by your form in order to provide your dropdown with options.

public function getDropdownOptions()
{
  return YourNestedModel::all()->listsNested('name', 'id');
}

Last updated

saleh.asadi.work19498
saleh.asadi.work19498

MarvinDurot said:

You can!

First the nested model must use the SimpleTree or NestedTree trait.

Then write a new method on the model used by your form in order to provide your dropdown with options.

public function getDropdownOptions()
{
 return YourNestedModel::all()->listsNested('name', 'id');
}

thanks

1-3 of 3

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.