Closed digitalunityca closed 3 years ago
Well, I've added this feature.
If your model state field has boolean data type you have two ways: First variant - is override toArray method in your Category model.
`public function toArray()
{
return array_merge(parent::toArray(),[ 'is_active' => $this->is_active ]);
}`
If $this-> is_active == false - the option will be disabled
Second way - you can use method withActiveKey - to override active_status key.
`NestedTreeAttachManyField::make('Offer Categories',"categories","App\Nova\Category")->withActiveKey('your_status')`
If your model state field has not boolean data type you have only one way - override toArray method and you need convert it to boolean value.
`public function toArray()
{
return array_merge(parent::toArray(),[ 'is_active' => $this->active_status == 'active' ]);
}`
Hope it helps)
Tnx! :)
Please add the ability to disable some options in the tree https://vue-treeselect.js.org/#disable-item-selection
Tnx!