PHP code example of bessamu / ajax-multiselect-nova-field

1. Go to this page and download the library: Download bessamu/ajax-multiselect-nova-field library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

bessamu / ajax-multiselect-nova-field example snippets




namespace App\Nova;

use App\Models\Catalog\Product;
use Bessamu\AjaxMultiselectNovaField\AjaxMultiselect;

class NewsResource extends Resource
{
    public function fields(Request $request)
    {
        return [
            AjaxMultiselect::make('Products', 'products')
                ->optionsModel(Product::class)
                ->optionsLabel('model')
                ->queryWhere('enabled', 1)
                ->placeholder('Select products')
                ->maxOptions(5)
        ];
    }
}