marotura/nested-multiselect

A nested multiselect field for Laravel Nova

1.0.2 2024-04-17 14:40 UTC

This package is auto-updated.

Last update: 2024-05-17 14:51:28 UTC


README

A nested multiselect field for Laravel Nova. This package makes use of vue3-treeselect

To install this package use:

composer require marotura/nested-multiselect

This field extends the Nova Multiselect field. At the moment this is the most basic implementation.

NestedMultiselect::make('Nested', 'nested')
    ->options([
        [
            'id' => 'a',
            'label' => 'a',
            'children' => [
                [
                'id' => 'aa',
                'label' => 'aa',
                ], [
                'id' => 'ab',
                'label' => 'ab',
                ],
            ]
        ], [
            'id' => 'b',
            'label' => 'b',
        ], [
            'id' => 'c',
            'label' => 'c',
        ]
    ])

Also make sure to cast your field to array of json

protected $casts = [
        'nested' => 'json',
    ];