LaravelPackages.net
Acme Inc.
Toggle sidebar
scouser03/nova4-multiselect

A Laravel Nova field.

510
0
1.4.0
About scouser03/nova4-multiselect

scouser03/nova4-multiselect is a Laravel package for a laravel nova field.. It currently has 0 GitHub stars and 510 downloads on Packagist (latest version 1.4.0). Install it with composer require scouser03/nova4-multiselect. Discover more Laravel packages by scouser03 or browse all Laravel packages to compare alternatives.

Last updated

A Multiselect field for Laravel Nova

Installation

First you must install this package in to a Laravel app that uses Nova via composer:

composer require scouser03/nova4-multiselect

Usage

namespace App\Nova;

use Spatie\TagsField\Tags;
use Scouser03\Nova4Multiselect\Nova4Multiselect;

class BlogPost extends Resource
{
    // ...

    public function fields(Request $request)
    {
        return [
            // ...

            Nova4Multiselect::make('select name with model', 'tags') //tags is relation name
                ->table('post_tag') //Relation table
                ->inputId('uuid') //Sets the id of the input element. default - id
                ->label('tag') // What key to use when generating option labels when each option is an object, default - name
                ->indexUpdateable(true) //when attach new tag to index resource
                ->model(Tag::class), //get all data with model

            Nova4Multiselect::make('select name with query', 'tags')
                ->table('post_tag')
                ->label('tag')
                ->query(Tag::query()->take(3)->get()), //pass collection data

            // ...
        ];
    }
}

License

The MIT License (MIT). Please see License File for more information.

Comments