laravel-admin icon indicating copy to clipboard operation
laravel-admin copied to clipboard

Cannot set config for loaded select input

Open amismailz opened this issue 1 year ago • 0 comments

  • Laravel Version: 8.83.26
  • PHP Version: 7.4
  • Laravel-admin: 1.8.19

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');

amismailz avatar Jan 31 '24 23:01 amismailz