'gt:0', 'area_id' => 'gt:0', 'address_realname' => 'require', 'area_info' => 'require', 'address_detail' => 'require', 'address_mob_phone' => 'checkMemberAddressMobPhone:1' // ]; protected $message = [ 'city_id.gt' => '请选择地区', 'area_id.gt' => '地区至少两级', 'address_realname.require' => '姓名不能为空', 'area_info.require' => '地区不能为空', 'address_detail.require' => '地址不能为空', 'address_mob_phone.checkMemberAddressMobPhone' => '联系方式不能为空' // ]; protected $scene = [ 'add' => ['address_realname', 'city_id', 'area_id'], 'edit' => ['address_realname', 'city_id', 'area_id'], 'address_valid' => ['address_realname', 'area_info', 'address_detail', 'address_mob_phone'], //mobile ]; protected function checkMemberAddressMobPhone($value) { if (empty(input('post.mob_phone')) && empty(input('post.tel_phone'))) { if (empty($value)) { return '联系方式不能为空'; } } return true; } }