Nova vue-tree-select field for management nested category relations.
phoenix-lib/nova-nested-tree-attach-many is a Laravel package for nova vue-tree-select field for management nested category relations..
It currently has 35 GitHub stars and 90.972 downloads on Packagist (latest version 1.8.0).
Install it with composer require phoenix-lib/nova-nested-tree-attach-many.
Discover more Laravel packages by phoenix-lib
or browse all Laravel packages to compare alternatives.
Last updated
Belongs To Many Field for simple manage Nested relation tree. Enables attaching relationships easily.

Delayed Loading data when tree has many records ( example 10k+ ).composer require phoenix-lib/nova-nested-tree-attach-many
This field uses tree provided by kalnoy/nestedset package
This field uses riophae/vue-treeselect under the hood
use PhoenixLib\NestedTreeAttachMany\NestedTreeAttachManyField;
public function fields(Request $request)
{
return [
NestedTreeAttachManyField::make('Offer Categories',"categories","App\Nova\Category"),
];
}
Your model should has NodeTrait form package kalnoy/nestedset see RoadMap
class Category extends Model
{
use NodeTrait;
}
Here are a few customization options
->searchable(bool $searchable)->withIdKey(string $idKey = 'id') // - id column name in your nested model->withLabelKey(string $labelKey = 'name') // - label column name in your nested model->withActiveKey(string $activeKey) // - active_status column name in your nested model used for disable options->withChildrenKey(string $childrenKey) // - children key in your nested model->withPlaceholder(string $placeholder) // - placeholder in tree select->withMaxHeight(int $maxHeight)->withSortValueBy(string $sortBy) // - @see https://vue-treeselect.js.org/#flat-mode-and-sort-values->withAlwaysOpen(bool $alwaysOpen) // - by default select is open, but you can change it behavior->withFlatten(bool $flatten) // - by default flatten is enabled, but you can change it behavior->useSingleSelect() // - ability for select only one value->useAsField() // - ability to write result to field without relationsuse Whitecube\NovaFlexibleContent\Flexible;
use PhoenixLib\NovaNestedTreeAttachMany\NestedTreeAttachManyField;
/**
* Get the fields displayed by the resource.
*
* @param \Illuminate\Http\Request $request
* @return array
*/
public function fields(Request $request)
{
return [
// ...
Flexible::make('Content')
->addLayout('Simple content section', 'tree_section', [
NestedTreeAttachManyField::make('Tree',"tree","App\Nova\Category")
->useAsField(),
])
];
}
This field also respects policies: ie Role / Permission
You can set min, max, size, required or custom rule objects
->rules('min:5', 'max:10', 'size:10', 'required', new CustomRule)`
Feel free to suggest changes, ask for new features or fix bugs yourself.