Dcat的多选功能使用问题--- 
                            
                                                    
                        
                    
                    
  
                    
                    protected $terminalactions_list =[
1 =>’测试’,
2=>’使用’,
];
protected function form()
    {
        return Form::make(new IotTerminalManager(), function (Form $form) {
        if ($form->isCreating()==1)
        {
            $form->multipleSelect(‘terminalactions’)->options($this->terminalactions_list);
        }
        else {
            $form->multipleSelect(‘terminalactions’)->options($this->terminalactions_list);
        }
        });
    }
}
在新增加时系统报错,local.ERROR: Array to string conversion {“exception”:”[object] (ErrorException(code: 0): Array to string conversion at /www/wwwroot/webapp/vendor/laravel/framework/src/Illuminate/Support/Str.php:674)
如果我把multipleSelect改成单选又可以成功增加,但是如果我把单选改成多选进行编辑时又可以成功,搞不清楚是什么。
如果使用multipleSelect,我通过调试得到的提交的数据是[‘1’,null],有个问题这个”null”是什么地主来的,然后我的编辑的时候得到的提交数据也有一个null(编辑时提交的数据是[‘1’,’2’,null],)这个时候不知道为什么又可以提交成功,不知道是什么原因。
另外在”查看”时针对多选的数据要怎么展示,我使用
            $show->field(‘terminalactions’)->using($this->terminalactions_list);这个方法并没有把多选数据展示出来
 
           
         
             
             
             
                     
                     
             
           
           关于 LearnKu
                关于 LearnKu
               
                     
                     
                     粤公网安备 44030502004330号
 粤公网安备 44030502004330号 
 
推荐文章: