'require|length:1,30', 'mobile' => 'require|mobile', 'address' => 'require|length:1,255', 'area_id' => 'require|integer|gt:0', 'is_default' => 'in:0,1', ]; /** * 提示消息 */ protected $message = [ 'receiver.require' => '收货人姓名不能为空', 'receiver.length' => '收货人姓名长度不能超过30个字符', 'mobile.require' => '手机号不能为空', 'mobile.mobile' => '手机号格式不正确', 'address.require' => '详细地址不能为空', 'address.length' => '详细地址长度不能超过255个字符', 'area_id.require' => '请选择所在地区', 'area_id.integer' => '地区ID必须为整数', 'area_id.gt' => '地区ID必须大于0', 'is_default.in' => '默认地址参数错误', ]; /** * 验证场景 */ protected $scene = [ 'add' => ['receiver', 'mobile', 'address', 'area_id', 'is_default'], 'edit' => ['receiver', 'mobile', 'address', 'area_id', 'is_default'], ]; }