1234567891011121314151617181920212223242526272829303132333435363738394041 |
- <?php
- namespace App\Http\Requests\Coach;
- use Illuminate\Foundation\Http\FormRequest;
- class SetLocationRequest extends FormRequest
- {
- public function rules()
- {
- return [
- 'latitude' => 'required|numeric|between:-90,90',
- 'longitude' => 'required|numeric|between:-180,180',
- 'type' => 'nullable|integer|in:1,2',
- 'province' => 'nullable|string|max:50',
- 'city' => 'nullable|string|max:50',
- 'district' => 'nullable|string|max:50',
- 'address' => 'nullable|string|max:255',
- 'adcode' => 'nullable|string|size:6',
- ];
- }
- public function messages()
- {
- return [
- 'latitude.required' => '纬度不能为空',
- 'latitude.numeric' => '纬度必须是数字',
- 'latitude.between' => '纬度必须在-90到90之间',
- 'longitude.required' => '经度不能为空',
- 'longitude.numeric' => '经度必须是数字',
- 'longitude.between' => '经度必须在-180到180之间',
- 'type.integer' => '位置类型必须是整数',
- 'type.in' => '位置类型只能是1(当前位置)或2(常用位置)',
- 'province.max' => '省份不能超过50个字符',
- 'city.max' => '城市不能超过50个字符',
- 'district.max' => '区县不能超过50个字符',
- 'address.max' => '详细地址不能超过255个字符',
- 'adcode.size' => '行政区划代码必须是6位',
- ];
- }
- }
|