'require|length:1,50', 'name|标识' => 'require|length:1,50|unique:screen_template', // 'img|图片' => 'require', 'nums|模块数量' => 'require|gt:0', ]; protected function checkContent($value,$rule,$data=[]) { if(!$data['content']){ return '模块绑定不能为空'; } $content = json_decode($data['content'],true); if(empty($content)){ return '模块绑定不能为空'; } foreach ($content as $k=>$v){ if($v['mid'] == 0){ return '未选择模块'; } } return true; } }