Laravel-Admin] Select多级联动编辑时不选中默认值

[Laravel-Admin] Select多级联动编辑时不选中默认值

 $form->select('ParkId',__('园区'))->options(Park::where('Id', '>', 0)->pluck('name' , 'id'))->loads(['BuildingId','OrganizationId'],['/admin/api/building','/admin/api/organization'])->required();
                $form->select('BuildingId', __('楼宇'))->options(function($id){ return Building::where('Id' , $id)->pluck('Name' , 'Id'); })->load('FloorId','/admin/api/floor')->required();
                $form->select('FloorId', __('楼层'))->options(function($id){ return Floor::where('Id' , $id)->pluck('Name' , 'Id') ; })->required();

多级联动如果第一级联动用API接口会导致编辑的时候默认选中丢失。。。请谨慎!(踩过的坑,因为第一级是接口请求导致一直失效)

你可能感兴趣的:(技术分享,php)