12345678910111213141516171819202122232425262728293031323334353637 |
- <?php
- namespace App\Http\Requests\Client\Account;
- use Illuminate\Foundation\Http\FormRequest;
- class WxLoginRequest extends FormRequest
- {
- public function rules(): array
- {
- return [
- 'openid' => 'required|string',
- 'userInfo' => 'nullable|array',
- 'userInfo.nickname' => 'nullable|string|max:50',
- 'userInfo.avatar' => 'nullable|string|url|max:255',
- 'userInfo.gender' => 'nullable|integer|in:0,1,2',
- 'userInfo.invite_code' => 'nullable|string|max:50',
- ];
- }
- public function messages(): array
- {
- return [
- 'openid.required' => '微信openid不能为空',
- 'openid.string' => '微信openid必须是字符串',
- 'userInfo.array' => '用户信息必须是数组格式',
- 'userInfo.nickname.string' => '昵称必须是字符串',
- 'userInfo.nickname.max' => '昵称不能超过50个字符',
- 'userInfo.avatar.url' => '头像必须是有效的URL地址',
- 'userInfo.avatar.max' => '头像URL不能超过255个字符',
- 'userInfo.gender.integer' => '性别必须是整数',
- 'userInfo.gender.in' => '性别值无效',
- 'userInfo.invite_code.string' => '邀请码必须是字符串',
- 'userInfo.invite_code.max' => '邀请码不能超过50个字符',
- ];
- }
- }
|