z-song / laravel-admin

Build a full-featured administrative interface in ten minutes
https://laravel-admin.org
MIT License
11.1k stars 2.81k forks source link

Cannot set config for loaded select input #5846

Open amismailz opened 5 months ago

amismailz commented 5 months ago

Description:

I'm trying to set custom configurations to a multipleSelect input. This select is loaded from another select. I see that the current implementation of loaded select is not configurable.

Steps To Reproduce:

$form->select('job_id', __('Job'))->options(Jobs::all()->pluck('title', 'id'))->load('experiences', url('admin/experiences/json-list'));
        $form->multipleSelect('experiences', __('Experiences'))->config('closeOnSelect', false)->options(function ($ids) {
            if ($ids) {
                $experience = Experience::find($ids[0]);
                return $experience->job->experiences()->pluck('title', 'id');
            } elseif (request()->job_id) {
                return Jobs::find(request()->job_id)->experiences()->pluck('title', 'id');
            }
        })->rules('required');