'required_without:access_token|string', 'access_token' => 'required_without:code|string', 'openid' => 'required_with:access_token|string' ]; if ($this->get('social_type') == 'weixin' && !$this->get('code')) { $rules['openid'] = 'required|string'; } return $rules; } }