Header Ads

How to use Laravel Nova Multiselect filed on resource form

This Laravel Nova package allows you to add a multi-select to Nova's arsenal of fields.


  
                   Multiselect::make('រាជធានី/ខេត្ត''province')
                    ->options(\App\Models\Province::pluck('khmer_name''no'))
                    ->sortable()
                    ->singleSelect()->creationRules('required'),

                    Multiselect::make('ក្រុង/ស្រុក/ខណ្ឌ''district')
                    ->singleSelect()
                    // ->dependsOn('province')
                    ->options([
                     \App\Models\District::where('pro_id'1)
                        ->get()
                        // ->groupBy('dis_code')
                        ->transform(function ($item$key) {
                            return $item->pluck('dis_name''id');
                        })->toArray()
                    ]),
                    Multiselect::make('ឃុំ/សង្កាត់''commune')
                    ->options(\App\Models\Commune::pluck('com_khmer''id'))
                    ->sortable()
                    ->singleSelect()   ->creationRules('required'),
                    Multiselect::make('ភូមិ''village')
                    ->options(\App\Models\Village::pluck('v_khmer''id'))
                    ->sortable()
                    ->singleSelect()->creationRules('required'),


Please check the officail document on Github nova-multiselect-field 










No comments:

Powered by Blogger.