arku/nova-multiselect

A Laravel Nova Multiselect Implementation.

Installs: 172 663

Dependents: 0

Suggesters: 0

Security: 0

Stars: 10

Watchers: 2

Forks: 0

Open Issues: 3

Language:Vue

dev-master 2019-10-06 15:32 UTC

This package is auto-updated.

Last update: 2024-06-07 02:02:35 UTC


README

  1. composer require arku/nova-multiselect

  2. Edit your Nova resource fields method

2.1 Get your data first to the numeric array (key => value)

2.2 Get your selected options in the seperated array (only keys)

$data = getSomeData();
$selectedOptions = getSelectedOptions();

2.3 Create a multiselect Field. Don't forget to import Nova\Multiselect\Multiselect.

Pass to the make method two params - human view name and database field to store it. Database field must be able to save text (json).

Pass as options your data and selected options

return [
    Multiselect::make('HUMAN_VIEW_NAME', 'DATABASE_FIELD_NAME')->options($data, $selectedOptions),
]